Is there a fast way of loading a shelf into a dictionary?

Victor S. Miller victor at idaccr.org
Thu Aug 17 09:25:03 EDT 2000


Is there a fast way of loading a shelf into a dictionary, or vice
versa, other than the direct code below?

# s is a shelf
d = {}
for k in s.keys():
   d[k] = s[k]
-- 
Victor S. Miller     | " ... Meanwhile, those of us who can compute can hardly
victor at idaccr.org    | be expected to keep writing papers saying 'I can do the
CCR, Princeton, NJ   | following useless calculation in 2 seconds', and indeed
    08540 USA        | what editor would publish them?"  -- Oliver Atkin



More information about the Python-list mailing list