keys(),values()和items()

a={'a':11,'b':'bb','c':321}
for x in a.items():
  print(x)  # 每条都输出来
print("------------")
for x in a.keys():
  print(x)  # 输出前面的
print("------------")
for x in a.values():
  print(x)  # 输出后面的
print("------------")

猜你喜欢

转载自www.cnblogs.com/pjishu/p/10427806.html