opposite of dict.items()
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Thu Aug 28 17:36:26 EDT 2003
|a = {}
|for k , v in zip(keys,values):
| a[k] = v
>>> keys = (1,2,3,4)
>>> vals = 'a b c d'.split()
>>> dct = dict(zip(keys,vals))
>>> dct
{1: 'a', 2: 'b', 3: 'c', 4: 'd'}
--
mertz@ | The specter of free information is haunting the `Net! All the
gnosis | powers of IP- and crypto-tyranny have entered into an unholy
.cx | alliance...ideas have nothing to lose but their chains. Unite
| against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------
More information about the Python-list
mailing list