draconux wrote:
>
> Hello all ,
> string.lstrip("source/old_prog","source/") return "ld_prog" instead of
> "old_prog"
You are misunderstanding what the second argument to lstrip does. It is
interpreted as a list of characters; and lstrip will remove the maximal
prefix of the string that consists of these characters. E.g.:
>>> 'aaabbbcccaax'.lstrip('abc')
'x'
The first character in your string that is not one of the characters
's', 'o', 'u', 'r', 'c', 'e', or '/' is 'l', so it strips all characters
up to that one.
-Edward
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com