字典键值对互换

#有字典 myinfor = {'shanghai':'0512','beijing':'071','hangzhou':'0523'}
myinfor = {'shanghai':'0512','beijing':'071','hangzhou':'0523'}
infor ={}
for k,v in myinfor.items():
    infor[v] = k
print(infor)
print(myinfor)

 

你可能感兴趣的:(python)