1 user = { 2 'xiaoming':'123', 3 'xiaobai':'111', 4 'xiaowang':'222' 5 } 6 # 直接循环字典,每次取到值的值是key 7 for i in user: 8 print("%s ==> %s" % (i,user.get(i))) 9 10 for k,v in user.items(): 11 print("%s ==> %s" % (k,v))
2023-12-15 23:34:16
1 user = { 2 'xiaoming':'123', 3 'xiaobai':'111', 4 'xiaowang':'222' 5 } 6 # 直接循环字典,每次取到值的值是key 7 for i in user: 8 print("%s ==> %s" % (i,user.get(i))) 9 10 for k,v in user.items(): 11 print("%s ==> %s" % (k,v))