给出这样的字典:
my_map = {'a': 1, 'b': 2}
如何反转此地图以获得:
inv_map = {1: 'a', 2: 'b'}
编者注: __CODE__改为__CODE__避免与内置函数冲突,__CODE__.下面有些评论可能会受到影响.
__CODE__
python mapping reverse dictionary
dictionary ×1
mapping ×1
python ×1
reverse ×1