我想从我的字典中只获取“代码”值,但不知道我是否正确。理想的情况是我出认沽应该是唯一的代码只从字典中获取特定值
peq = {
'sg':{'code':9, 'perror':0},
'6e':{'code':17, 'perror':0},
'g8':{'code':25, 'perror':0},
'i7':{'code':33, 'perror':0},
'9h':{'code':41, 'perror':0},
'it':{'code':49, 'perror':0},
'ic':{'code':57, 'perror':0},
'9w':{'code':65, 'perror':0},
's2':{'code':73, 'perror':0},
'ai':{'code':81, 'perror':0}
}
for the_value['code'], in peq.iteritems():
print the_value
你是什么意思你不知道?它工作与否? – Maroun
'print the_value ['code']''而不是'print the_value' –