[Tutor] Is there a programmatic use for keys() and values()
Jim Mooney
cybervigilante at gmail.com
Sat Jun 15 21:48:35 CEST 2013
On 15 June 2013 11:51, Chris “Kwpolska” Warrick <kwpolska at gmail.com> wrote:
> The standard use is:
>
> for k, v in d.items():
> do_stuff_with_dict_items_here()
>
Yes, they're easy to get keys = [x for x in d], or vals = [d[x] for x in d]
It's just that Python usually does what I expect and presents me with
something useful. All I can do is look at the d.keys or d.values
result. But then, I could look at a usable list or tuple just as
easily, so I'm surprised they made it kind of useless.
--
Jim
After indictment the bacon smuggler was put on the no-fry list
More information about the Tutor
mailing list