📌  相关文章
📜  在python代码示例中将键转换为值

📅  最后修改于: 2022-03-11 14:45:35.080000             🧑  作者: Mango

代码示例1
old_dict = {'A': 67, 'B': 23, 'C': 45, 'D': 56, 'E': 12, 'F': 69, 'G': 67, 'H': 23} 
  
new_dict = dict([(value, key) for key, value in old_dict.items()])
print(new_dict)
for i in new_dict: 
    print(i, " :  ", new_dict[i])