Ulrich Eckhardt wrote:
Hi!
"'abc'.split('')" gives me a "ValueError: empty separator".
However, "''.join(['a', 'b', 'c'])" gives me "'abc'".
Why this asymmetry? I was under the impression that the two would be
complementary.
Uli
I think the problem is that join() is lossy; if you try "".join(['a',
'bcd', 'e']) then there's no way to reconstruct the original list with
split(). Now that can be true even with actual separators, but perhaps
this was the reasoning.
Anyway, if you want to turn a string into a list of single-character
strings, then use
list("abcde")
DaveA
--
http://mail.python.org/mailman/listinfo/python-list