Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #invert #dictionary #python
ADD COMMENT
Topic
Name
6+1 =