d={'a':1,'b':2}
print(d.items())#把字典转成list
for k,v in d.items():#先将字典转成了list
print(k,v)
for k in d:#高效循环字典的方法
print(k,d.get(k))
转载于:https://www.cnblogs.com/pengwa1226/p/9410717.html
d={'a':1,'b':2}
print(d.items())#把字典转成list
for k,v in d.items():#先将字典转成了list
print(k,v)
for k in d:#高效循环字典的方法
print(k,d.get(k))
转载于:https://www.cnblogs.com/pengwa1226/p/9410717.html