[Tutor] Hi
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Wed Mar 22 08:04:36 CET 2006
> I am new to python and I am going through the URL
> http://www.ibiblio.org/obp/thinkCSpy/index.htm, At the moment I am going
> through the Chapter 7 Strings, I am stuck with understanding slice which
> is a part of a String, I am not able to understand how it functions
Hello,
A "slice" takes a string and returns a "substring" of that string. For
example, if we have a string like:
######
>>> mystring = "supercalifragilisticexpialidocious"
######
then we can select different portions of the string by indicating the
start and end positions. For example, the first ten characters of
mystring can be extracted using a slice:
######
>>> mystring[0:10]
'supercalif'
######
Is this what you are confused about?
Please give us more details on where you're getting stuck, and we will do
what we can to help clarify.
Please continue to reply to 'python-help at python.org': do not email me
directly. Although I may not personally have the time to answer, I'm sure
at least one of the other helpers on the list do, so by continuing the
conversation on python-help, we'll be able to guarantee that your
questions are not lost.
More information about the Tutor
mailing list