List to dict conversion

Wujek wujek at wujek.com
Fri Oct 3 07:28:34 EDT 2003


Gerrit Holl wrote:

> How about:
> dict([s.split(':') for s in l])
> 
> Don't know if it's faster, simplier or prettier, but I find it easier to read.
> This may not be the case if you aren't familiar with list comprehensions, though.

No, I like it. Thank you (and Alex too).

Regards.





More information about the Python-list mailing list