[Tutor] Is there a programmatic use for keys() and values()

Jim Mooney cybervigilante at gmail.com
Sat Jun 15 20:41:37 CEST 2013


When I try to get the keys of a dictionary, such as d.keys(), I get
the below instead of a plain list, and it's not very usable. How can I
use the keys from this like it was a list, or is this basically
useless other than to see the keys or values?

*** Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC
v.1600 32 bit (Intel)] on win32. ***
>>> d.keys()
dict_keys(['alpha', 'olf', 'bog', 'dog'])

-- 
Jim
After indictment the bacon smuggler was put on the no-fry list


More information about the Tutor mailing list