Merge dictionary

Hello Team,

see code below
ann=dict(a=5,b=7)
bnn=dict(a=5,b=7)

cnn=[ann,bnn]
dnn=[cnn,ann]
print dnn

Output is :
[[{‘a’: 5, ‘b’: 7}, {‘a’: 5, ‘b’: 7}], {‘a’: 5, ‘b’: 7}]

How to I have the output as
[{‘a’: 5, ‘b’: 7}, {‘a’: 5, ‘b’: 7}, {‘a’: 5, ‘b’: 7}]

Hi Jahnavi,

not sure why you are posting this pure pyhton question in the plotly forum?

As a possible answer though:

ann=dict(a=5,b=7)
bnn=dict(a=5,b=7)

cnn=[ann,bnn]
dnn=cnn+[ann]
print dnn