Problem with string parsing

Simon Brunning simon.brunning at gmail.com
Tue Oct 5 10:47:46 EDT 2004


On 5 Oct 2004 07:38:09 -0700, Mike Howard <mhoward at mahoward.com> 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

string.strip() and friends strips from the first argument *any* of the
characters in the second argument:

>>> string.strip('***###spam***###eggs***###','*#')
'spam***###eggs'

Make sense now?

-- 
Cheers,
Simon B,
simon.brunning at gmail.com,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list