原字典:

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

 经过相互对换:

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

 结果就是:

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

 

相关文章:

  • 2021-12-22
  • 2018-06-22
  • 2021-11-15
  • 2020-10-14
  • 2022-01-01
  • 2018-02-08
  • 2021-12-22
  • 2021-12-22
猜你喜欢
  • 2021-11-04
  • 2021-11-04
  • 2021-11-04
  • 2021-11-04
  • 2021-11-04
  • 2021-08-15
  • 2021-11-04
  • 2019-03-19
相关资源
相似解决方案