Issue 1380970: split() description not fully accurate (original) (raw)
The page http://docs.python.org/lib/string-methods.html reads, in part, "If sep is not specified or is None, a different splitting algorithm is applied. First, whitespace characters (spaces, tabs, newlines, returns, and formfeeds) are stripped from both ends." However, this is not the behaviour that I'm seeing. (Although, I should note that I'd find the described behaviour more desirable.) Example,
trow = '1586\tsome-int-name\tNODES: 111_222\n' print trow 1234 some-int-name NODES: 111_222
trow.split(None,2) ['1234', 'some-int-name', 'NODES: 111_222\n']
end example.
Notice that the trailing newline has not been stripped as the documentation said it should be. Thanks all.
K.C.
Logged In: YES user_id=741142
Also, (oops) the example comes from the most recent version:
$ python Python 2.4.2 (#2, Oct 4 2005, 13:57:10) [GCC 3.4.2 [FreeBSD] 20040728] on freebsd5 Type "help", "copyright", "credits" or "license" for more information.