Combine dictionary values
Combines two or more dictionaries, creating a list of values for each key.
- Create a new
collections.defaultdictwithlistas the default value for each key and loop overdicts. - Use
dict.append()to map the values of the dictionary to keys. - Use
dict()to convert thecollections.defaultdictto a regular dictionary.