Jerome Alet wrote:
> On Fri, 15 Dec 2000, Steve Drees wrote:
> > somestring[:1999] is the first 2000 characters of somestring.
> Not to be a poseur but:
me either ;^)=
> somestring[:1999] is the first 1999 characters of somestring, because
> in Python indices begin at 0, e.g.:
Actually, it is because the number 1999 refers to the the spot
*inbetween* 1998 and 1999. Basically, in a list of '0,1,2,3',  is the
first 'comma', and  the second, and so on. Counting that way shows
that you never include the 1999 (or the three in your example. It isn't
that indices start at zero, it is due to the counting being done on the
seperator, not the item in the list.
> print a[:3] gives "012" which are the first 3 characters from a.
Right, because 'a' is being treated as [0,1,2,3], and you are saying
"give me everything up to the third comma". :)
yes-I-am-nitpicking-ly y'rs Bill Anderson
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -