Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93053 > unrolled thread

Re: Looking up a dictionary _key_ by key?

Started byBen Finney <ben+python@benfinney.id.au>
First post2015-06-24 10:33 +1000
Last post2015-06-24 10:33 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Looking up a dictionary _key_ by key? Ben Finney <ben+python@benfinney.id.au> - 2015-06-24 10:33 +1000

#93053 — Re: Looking up a dictionary _key_ by key?

FromBen Finney <ben+python@benfinney.id.au>
Date2015-06-24 10:33 +1000
SubjectRe: Looking up a dictionary _key_ by key?
Message-ID<mailman.1.1435106041.3674.python-list@python.org>
Dan Stromberg <drsalists@gmail.com> writes:

> Is there a way of getting the key used by the dictionary, short of
> storing a reference to it in the value, or using a second dictionary?

The dictionary knows its keys and can provide them on request. Call the
‘dict.keys’ method to get them as a collection.

-- 
 \     “Capitalism has destroyed our belief in any effective power but |
  `\      that of self interest backed by force.” —George Bernard Shaw |
_o__)                                                                  |
Ben Finney

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web