Faster (smarter?) dictionary building
David Eppstein
eppstein at ics.uci.edu
Thu Oct 30 15:24:23 EST 2003
In article <mailman.259.1067543149.702.python-list at python.org>,
"Michael T. Babcock" <mbabcock at fibrespeed.net> wrote:
> I have a list of column headings and an array of values:
> headings, values = ['a', 'b', 'c'], [1, 2, 3]
>
> I want to construct a dictionary such that d['a'] = 1 and so on.
d = dict(zip(headings,values))
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list