list - Append a dictionary in Python -
how can append dictionary following in python?
list1 = {'value1':1} list2 = {'value2':2} list1.append(list2)
when appending:
'dict' object has no attribute 'append'
how can join both list then?
these dictionaries, not lists.
try list1.update(list2)
the semantics of update , append different, because underlying data structures different. values existing keys in dictionary overwritten values in argument dictionary.
the section of python tutorial on data structures goes through , whole lot more.
Comments
Post a Comment