Behaviour of str.split
Will McGugan
news at NOwillmcguganSPAM.com
Mon Apr 18 11:16:00 EDT 2005
Hi,
I'm curious about the behaviour of the str.split() when applied to empty
strings.
"".split() returns an empty list, however..
"".split("*") returns a list containing one empty string.
I would have expected the second example to have also returned an empty
list. What am I missing?
TIA,
Will McGugan
--
http://www.willmcgugan.com
"".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-84)%26) for c
in "jvyy*jvyyzpthtna^pbz" ] )
More information about the Python-list
mailing list