string.split bug?

Erik Max Francis max at alcyone.com
Wed Feb 25 11:15:39 CET 2004


MetalOne wrote:

> string.split("") ==> []
> string.split("",",") ==> ['']
> 
> I did not expect these to have different outputs.

S.split(None) is a special case which keys off of all whitespace, not
just a single delimiter string.  So when presented with an input string
that contains nothing but whitespace, it strips everything and doesn't
find any tokens at all.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Who, my friend, can scale Heaven?
    -- _The Epic of Gilgamesh_



More information about the Python-list mailing list