[New-bugs-announce] [issue1240] str.split possible bug
report at bugs.python.org
Fri Oct 5 15:20:23 CEST 2007
New submission from Tim Gordon:
>From the docs for str.split:
"If sep is not specified or is None... First, whitespace characters are
stripped from both ends. Then, words are separated by arbitrary length
strings of whitespace characters."
However, ' a b c '.split(None, 1) returns ['a', 'b c '] indicating that
the "stripped from both ends" isn't taking place, but that it's
removing whitespace as it goes and never gets to the end as it stops
parsing when it hits the first split.
Note this is easily worked around by calling str.strip().split(None,
1), but it would be good not to have to.
I've tested this on windows version 2.5, and 2.4.4 for Debian
title: str.split possible bug
versions: Python 2.4, Python 2.5
Tracker <report at bugs.python.org>
More information about the New-bugs-announce