I don't know who's going crazy here... but I checked that straight from the python 2.4 interpreter...

Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
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 this code is broken.


Hope we figure it out.
Jacob

This code is broken. lstrip('gonl ') will remove *all* leading g, o, n, l and space, in any order:
>>> s='go long on log buddy!'
>>> s.lstrip('gonl ')
'buddy!'


Instead of y.lstrip('gonl ') you should use y[5:] or maybe y[len('gonl '):]

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor



_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to