Ka-Ping Yee wrote:
> Hmm... would it? Or should two split points with nothing between
> them produce empty strings, i.e. you would have to do
> x.split(('\r\n', '\r', '\n'))
> to get the behaviour of x.splitlines()?
Right, Georg's example would be unintuitive given the current behavior
of str.split which will happily provide zero-width matches when it hits
separators in sequence.
Perl bypasses the issue by having split
(http://perldoc.perl.org/functions/split.html) take a regex; I've only
rarely used this for complex matches, though. I tried a Google code
search for
lang:perl split\(?\s?\/\[ (simple multiple separators)
lang:python \.splitlines\s?\(
lang:python \.split\s?\(
but the number of results seems to oscillate between 300 and 100000, so
that didn't help much.
--
Ivan Krstić <[EMAIL PROTECTED]> | GPG: 0x147C722D
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com