str.split() with empty separator

Ulrich Eckhardt eckhardt at satorlaser.com
Tue Sep 15 08:31:26 EDT 2009


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

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list