The documentation of string.split() says: "... The returned list will then have one more item than the number of non-overlapping occurrences of the separator in the string. ..." The behaviour of split with Python 2.3.3 is: >>> '\tb'.split() ['b'] # Bug? >>> '\tb'.split('\t') ['', 'b'] >>> 'a\t\tb'.split() ['a', 'b'] >>> 'a\t\tb'.split('\t') ['a', '', 'b'] >>> I think there are different interpretations of what a separator is. That is not necessarily a bug, because without stripping a new-line at the end of the string would yield a non-intuitive result list. However, the difference between split with and without the 'sep' argument should be documented. Andreas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4