converting from perl: variable sized unpack
Skip Montanaro
skip at pobox.com
Sat Jul 14 18:12:25 EDT 2001
>>>>> "RS" == Roy Smith <roy at panix.com> writes:
RS> What's the best way to translate this perl snippet into python:
RS> ($f1, $f2, $f3, $f4, $f5, $f6) = split ('\s+', $line);
BAW> Python doesn't work this way, but I've been thinking about writing
BAW> a PEP to make sequence unpacking less strict.
What about writing a simple class to do it? Instead of raising an exception
in __getitem__ it would just return "" or None.
--
Skip Montanaro (skip at pobox.com)
(847)971-7098
More information about the Python-list
mailing list