Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

invert a dictionary python

d = {'a':1, 'b':2, 'c':3}
inverted_d = {}

for k, v in d.items():
  inverted_d[v] = k
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #invert #dictionary #python
ADD COMMENT
Topic
Name
3+5 =