On Nov 21, 2008, at 2:08 AM, Steven D'Aprano wrote:
a, b = line.split()
Note that in a case like this, you may want to consider using
partition instead of split:
a, sep, b = line.partition(' ')
This way, if there happens to be more than one space (for example,
because the Unicode character you're mapping to happens to be a
space), it'll still work. It also better encodes the intention, which
is to split only on the first space in the line, rather than on every
space.
(It so happens I ran into exactly this issue yesterday, though my
delimiter was a colon.)
Cheers,
- Joe
--
http://mail.python.org/mailman/listinfo/python-list