reverse key list value dictionary python code example
Example: 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
orig = { 1:'A', 2:'B', 3:'C' }
new = dict(zip(orig.values(), orig.keys()))
new == {'A': 1, 'B': 2, 'C': 3} #True