[issue1123] split(None, maxsplit) does not strip whitespace correctly

Nir Soffer report at bugs.python.org
Tue Sep 11 00:32:48 CEST 2007


Nir Soffer added the comment:

I did not look into the source, but obviously there is striping of 
leading and trailing whitespace. 

When you specify a separator you get:
>>> '  '.split(' ')
['', '', '']

>>> '  a  b  '.split('  ')
['', 'a', 'b', '']

So one would expect to get this without striping:
>>> '  a  b  '.split()
['', 'a', 'b', '']

But you get this:
>>> '  a  b  '.split()
['a', 'b']

So the documentation is correct.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1123>
__________________________________


More information about the Python-bugs-list mailing list