string.split bug?

MetalOne jcb at iteris.com
Wed Feb 25 02:08:06 EST 2004


string.split("") ==> []
string.split("",",") ==> ['']

I did not expect these to have different outputs.

I have a string with comma delimited numbers.
There can be zero or more numbers in the string
s = "0x41, 0x42"

I wanted to do
numbers = map(lambda x: int(x,16), string.split(s,","))

However, when there are no numbers, this generates an error.



More information about the Python-list mailing list