"Robert Kern" wrote:

> Ignore the last message.
>
> translations = [x.strip(" '") for x in line.split('|')]
> d = dict(zip(translations[::2], translations[1::2]))

Or in case you're working with a lot and/or huge records, the second
line can be more efficiently written as:

from itertools import izip, islice
d = dict(izip(islice(translations,0,None,2),
              islice(translations,1,None,2)))

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to