原字典:

d1 = {
    'en':'英语',
    'cn':'中文',
    'fr':'法语',
    'jp':'日语'
} 

 经过相互对换:

d1_inverse = {values:keys for keys,values in d1.items()}

 结果就是:

print(d1_inverse)
# {'英语': 'en', '中文': 'cn', '法语': 'fr', '日语': 'jp'}

 

相关文章:

  • 2021-09-10
  • 2021-09-27
  • 2022-03-04
  • 2022-02-19
  • 2021-11-26
  • 2022-02-22
  • 2021-06-06
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2021-06-09
  • 2021-08-25
  • 2021-08-31
  • 2021-10-16
  • 2021-09-14
相关资源
相似解决方案