Stupid string.split question

Brian Kelley bkelley at
Wed Aug 6 20:22:40 CEST 2003

Is there any conceptual reason why

"ABCDEF".split("") shouldn't equal ["A", "B", "C", "D", "E", "F"]?

The error says empty seperator, but the result makes sense given that 
fact and the fact that:

"".join(["A", "B", "C", "D", "E", "F"]) == "ABCDEF"

It seems that if you can join with an empty seperator, you should be 
able to split with one.

I suppose the pythonic way is [x for x in "ABCDEF"] which doesn't make 
as much sense to be.

This question is also equivalent to "ABCDEF".reverse() since that is 
what I am using these for.  Currently the code is

l = [x for x in forward_string]
reversed_string = "".join(l)

Just asking.

More information about the Python-list mailing list