[Tutor] Parsing string with variable length delimiter?
Michael Janssen
mi.janssen at gmail.com
Thu Sep 9 15:58:46 CEST 2004
> DOH! Simple and easy. Why didn't I try that when it's plain as day the
> separator is _optional_ in the docs?? ;)
even more: when you need the second optional argument maxsplit, you
can reenable the nice default behaviour with None. Instead of a lame
aString.split(" ", 1)
you can do
aString.split(None, 1)
to keep any-number-of-whitespace-splitting & stripping behaviour.
Michael
More information about the Tutor
mailing list