[Tutor] Better structure?
alan.gauld at freenet.co.uk
Wed Feb 2 09:35:47 CET 2005
> I don't know who's going crazy here... but I checked that straight
> python 2.4 interpreter...
> Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]
> Type "help", "copyright", "credits" or "license" for more
> >>> a = "go on long buddy"
> >>> a.lstrip("gonl")
> ' on long buddy'
> >>> a = "go long on log buddy!"
> >>> a.lstrip('gonl')
> ' long on log buddy!'
> In both cases, lstrip just removed the first word... I don't see how
> code is broken.
It removed all the g,o,n & l's up till it found a character
that wasn't in your list - a space. Thats what you told it to do.
If you want the space stripped add one to your list...
More information about the Tutor