Walk through dictionary keys?
Fredrik Lundh
fredrik at effbot.org
Tue Dec 19 11:28:08 EST 2000
Carsten Gaebler wrote:
> Is there a way of 'walking' through the keys of a dictionary?
keys()
> If I have a large dictionary I'd like to prevent
>
> for key in d.keys():
> do_something
>
> because this makes a copy of all the keys.
wrong. it creates references to all the keys, not
copies of them.
</F>
<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->
More information about the Python-list
mailing list