python dict 遍历

d = {'a' : 1, 'b':2, 1 : 'one', 2:'two'}
for key in d:
    print(d[key])

print('...')

for key, value in d.items() :
    print(key, value)
    
keys = d.keys()
print(type(keys))
print(keys)

你可能感兴趣的:(python dict 遍历)