Newb ?

Paul Watson pwatson at redlinepy.com
Thu Nov 17 16:20:24 CET 2005


Chad Everett wrote:
> Hey guys,
> 
> Thanks for the hint.
> I found that info last night but I could never get it to print more than 
> just the last letter.
> or it would only print partially.
> I was using just a single colon,  the double colon did it.

If you were using a single colon, then it would print everything except 
the last character.  Use the Python interactive mode for experimentation.

$ python
Python 2.4.1 (#1, Jul 19 2005, 14:16:43)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> s = 'abc'
 >>> s
'abc'
 >>> s[:-1]
'ab'
 >>> s[-1]
'c'



More information about the Python-list mailing list