Creating a nested dictionary comprehension in Python 2.7
问题 I have a nested tuple returned from a MySQL cursor.fetchall() containing some results in the form (datetime.date, float) . I need to separate these out in to a nested dictionary of the form [month/year][day of month] - so I would like to have a dictionary (say) readings which I would reference like readings['12/2011'][13] to get the reading for 13th day of the month '12/2011'. This is with a view to producing graphs showing the daily readings for multiple months overlaid. My difficulty is