sort tuples in dictionary based on time value
问题 I have a dictionary looking like this: dict1 = {'key1': ['x1', [(time1,value1), (time3,value3), (time2,value2)]], 'key2': ['x2', [(time6,value6), (time4,value4), (time5,value5)]], ...} For each key in the dictionary, I wish to sort the tuples based on the time. Looking at the example above, assume that time1 < time2 < time3 time4 < time5 < time6 The output I wish is then dict1 = {'key1': ['x1', [(time1,value1), (time2,value2), (time3,value3)]], 'key2': ['x2', [(time4,value4), (time5,value5),