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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -