Syntax for extracting multiple items from a dictionary

Bengt Richter bokr at oz.net
Tue Nov 30 17:38:08 EST 2004


On Tue, 30 Nov 2004 21:54:46 GMT, bokr at oz.net (Bengt Richter) wrote:
[...]
>
>If there's an overall why for doing it at all, why not just iterate through
>keys of interest? I.e., (untested)
>
> dict( (key, row[key]) for key in cols )
>
Sorry Anton, I didn't see your post. Newsfeed delays seem
to make this kind of duplication fairly likely ;-/

Regards,
Bengt Richter



More information about the Python-list mailing list