how to invert dictionary python code example
Example 1: invert dictionary python
inv_map = {v: k for k, v in my_map.items()}
Example 2: invert dictionary python
orig = { 1:'A', 2:'B', 3:'C' }
new = dict(zip(orig.values(), orig.keys()))
new == {'A': 1, 'B': 2, 'C': 3} #True