Answers for "invert python dictionary key and value"

5

invert dictionary python

inv_map = {v: k for k, v in my_map.items()}
Posted by: Guest on August-23-2020
1

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
Posted by: Guest on January-19-2021

Code answers related to "invert python dictionary key and value"

Python Answers by Framework

Browse Popular Code Answers by Language