Dictionary from list?
Martin von Loewis
loewis at informatik.hu-berlin.de
Mon Oct 22 12:27:23 EDT 2001
"Magnus Lie Hetland" <mlh at idi.ntnu.no> writes:
> > b) {(1,2) : (3,4)}
> >
> > Your answer is probably b), but many Python people would rather expect
> > a) (since it would be the reverse of the .items() operation).
>
> Why would one want b?! (I must have missed some posts here...)
Because the original poster wanted that
['k1','v1','k2','v2']
is converted to
{'k1':'v1', 'k2':'v2'}
Regards,
Martin
More information about the Python-list
mailing list