accessing keys in dict

james_027 cai.haibin at gmail.com
Wed Aug 15 03:58:26 CEST 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