Python: How to append to existing key of a dictionary? -
i have dictionary multidimensional lists, so:
mydict = {'games':[ ['post 1', 'post 1 description'], ['post2, 'desc2'] ], 'fiction':[ ['fic post1', 'p 1 fiction desc'], ['fic post2, 'p 2 fiction desc'] ]}
how add new list ['post 3', 'post 3 description'] games key list?
you're appending value (which list in case), not key.
mydict['games'].append(...)
Comments
Post a Comment