I am parsing JSON, which stores various pieces of code, and I first create a dictionary of languages used by these pieces:
snippets = {'python': {}, 'text': {}, 'php': {}, 'js': {}}
Then, when looping through JSON, I want to add fragment information to my dictionary in the dictionary above. For example, if I had a JS fragment, the end result would be:
snippets = {'js': {"title":"Script 1","code":"code here", "id":"123456"} {"title":"Script 2","code":"code here", "id":"123457"} }
Do not stir up the water, but in PHP working on a multidimensional array, I would just do the following (I look something similar):
snippets['js'][] = array here
I know that one or two people talked about how to create a multidimensional dictionary, but they cannot track the addition of the dictionary to the dictionary in python. Thanks for the help.
source share