string stripping issues

orangeDinosaur trevis.crane at gmail.com
Thu Mar 2 16:45:54 EST 2006


Hello,

I am encountering a behavior I can think of reason for.  Sometimes,
when I use the .strip module for strings, it takes away more than what
I've specified.  For example:

>>> a = '    <TD WIDTH=175><FONT SIZE=2>Hughes. John</FONT></TD>\r\n'

>>> a.strip('    <TD WIDTH=175><FONT SIZE=2>')

returns:

'ughes. John</FONT></TD>\r\n'

However, if I take another string, for example:

>>> b = '    <TD WIDTH=175><FONT SIZE=2>Kim, Dong-Hyun</FONT></TD>\r\n'

>>> b.strip('    <TD WIDTH=175><FONT SIZE=2>')

returns:

'Kim, Dong-Hyun</FONT></TD>\r\n'

I don't understand why in one case it eats up the 'H' but in the next
case it leaves the 'K' alone.




More information about the Python-list mailing list