d={'a':'apple','b':'ball'}
d.keys() # displays all keys in list
['a','b']
d.values() # displays your values in list
['apple','ball']
d.items() # displays your pair tuple of key and value
[('a','apple'),('b','ball')
打印键值,方法一
for x in d.keys():
print(x +" => " + d[x])
另一种方法
for key,value in d.items():
print(key + " => " + value)