I generated a dictionary of a list of tuples via HTML page scraping in an attempt to implement a scripting language. I would like to take that in-memory construct and generate Python code that initializes my dictionary to those values. I'm pretty sure I can write that up myself, but this isn't the first time I've encountered this situation, and it struck me that it's likely this has already been solved and might even be handled natively.
Example
mydict = {}
mydict ['item1'] = []
mydict ['item2'] = []
mydict ['item1'].append(('id', 11, 23))
mydict ['item1'].append(('id2', 21, 2))
mydict ['item1'].append(('id3', 13, 53))
mydict ['item1'].append(('id', 31, 23))
mydict ['item1'].append(('id2', 21, 9))
mydict ['item1'].append(('id3', -5, 7))
My actual data has several hundred items, so I'd prefer not to have to write them out.