string stripping issues

ianaré ianare at gmail.com
Thu Mar 2 17:10:36 EST 2006


from the python manual:

strip( [chars])
The chars argument is not a prefix or suffix; rather, all combinations
of its values are stripped:
    >>> 'www.example.com'.strip('cmowz.')
    'example'

in your case since the letter 'H' is in your [chars] and the name
starts with an H it gets stripped, but with the second one the first
letter is a K so it stops there.
Maybe you can use:

>>> a[31:]
'Hughes. John</FONT></TD>\r\n'
>>> b[31:]
'Kim, Dong-Hyun</FONT></TD>\r\n'

but maybe what you REALLY want is:

>>> a[31:-14]
'Hughes. John'
>>> b[31:-14]
'Kim, Dong-Hyun'




More information about the Python-list mailing list