Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

merge a list of dictionaries python

>>> from collections import ChainMap
>>> a = [{'a':1},{'b':2},{'c':1},{'d':2}]
>>> dict(ChainMap(*a))
{'b': 2, 'c': 1, 'a': 1, 'd': 2}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #merge #list #dictionaries #python
ADD COMMENT
Topic
Name
4+5 =