Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python inverse dict with repeating values

from collections import defaultdict

reversed_dict = defaultdict(list)
for key, value in mydict.items():
    reversed_dict[value].append(key)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #inverse #dict #repeating #values
ADD COMMENT
Topic
Name
2+8 =