[Tutor] Hi
Kaushal Shriyan
kaushalshriyan at gmail.com
Wed Mar 22 08:14:51 CET 2006
On 3/22/06, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
>
> > 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.
>
>
Thanks Danny Yoo
I got this, Lets say if its mystring[n:m] where n may be another
number and m may be another number so how will it work in that case,
so this becomes general and makes more clear
Lets say if its mystring[3:8] so how will i evaluate it
Thanks for all the help
Regards
Kaushal
More information about the Tutor
mailing list