Python-字典元素的遍历

for item in scores:

  print(item)

1 scores = {'张三': 100, '李四': 98, '王五': 45}
2 # 字典元素的遍历
3 for item in scores:
4     print(item, scores[item], scores.get(item))

 

posted @ 2022-02-24 15:21  Xxiaoyu  阅读(49)  评论(0编辑  收藏  举报