Problem with string parsing

Remy Blank remy.blank_asps at pobox.com
Tue Oct 5 10:46:09 EDT 2004


Mike Howard wrote:
> If I do this:
> string.lstrip('1_mature_dt=10-May-2002','1_mature_dt=')
> I get:
> '0-May-2002'
> Which I did not expect

The second argument of lstrip() is not a string to remove from the
beginning of a string but a set of characters to strip. In this case,
there is a '1' in that set, so it gets stripped from the '10-May-2002'.

> Is this a bug or am I doing something wrong?

It is by design.

-- Remy


Remove underscore and suffix in reply address for a timely response.




More information about the Python-list mailing list