strip weirds

Robin Becker robin at jessikat.fsnet.co.uk
Thu Dec 14 13:43:03 CET 2000


Can somebody explain why strip behaves differently with and without an
argument?

>>> from string import split
>>> split(' ')
[]
>>> split(' ',' ')
['', '']
>>> split('  ')
[]
>>> split('  ',' ')
['', '', '']
>>> 

with the default whitespace arg seems as though a run of whitespace is
being treated as a single character.
-- 
Robin Becker



More information about the Python-list mailing list