Inconsistent behavior of split on empty string

Batista, Facundo FBatista at uniFON.com.ar
Tue Feb 17 13:12:47 EST 2004


bk_kl at gmx.de wrote:

#- I think the following behavior of the build in function 
#- 'split' is inconsistent.
#- What do you think?
#- 
#- >>> "".split()
#- []
#- >>> "".split(";")
#- ['']

Don't know if it's inconsistent, but at least it's not explicited in the
Library Reference:

split([sep [,maxsplit ] ])
	
	Return a list of the words in the string, using sep as the delimiter
string. If maxsplit is given, at most maxsplit
	splits are done. If sep is not specified or None, any whitespace
string is a separator.


.	Facundo




More information about the Python-list mailing list