摘要: 1.遍历 m = {'a': 1, 'b': 2, 'c': 3} n = {} for k, v in m.items(): n[v] = k print(n) 2.字典推导式 m = {'a': 1, 'b': 2, 'c': 3} n = {v: k for k, v in m.items() 阅读全文
posted @ 2023-11-14 16:52 python学习者0 阅读(29) 评论(0) 推荐(0) 编辑