Skip to main content
 首页 » 编程设计

python之字典中的反向元素

2025年05月04日10Terrylee

<分区>

Possible Duplicate:
Python reverse / inverse a mapping

假设我有以下内容。

D = {'a':1,'b':2,'c':3} 

我将如何反转每个元素以便得到

inverseD = {1:'a',2:'b',3'c'}