accessing keys in dict

james_027 cai.haibin at gmail.com
Tue Aug 14 21:58:26 EDT 2007


hi,

a_dict = {'name':'apple', 'color':'red', 'texture':'smooth',
'shape':'sphere'}

is there any difference between ..

for key in a_dict:

from

for key in a_dict.keys():


which is more preferred? any difference in performance?

THanks
james




More information about the Python-list mailing list