Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How do I merge two dictionaries in a single expression (taking union of dictionaries)?

z = dict(list(x.items()) + list(y.items()))

or 

z = x.copy()
z.update(y)
 
PREVIOUS NEXT
Tagged: #How #I #merge #dictionaries #single #expression #union
ADD COMMENT
Topic
Name
9+1 =