lis = [['2016-10-01,83928373'],['2016-10-01,83928373'],['2016-10-02,93928373'],['2016-10-01,234242'],['2016-10-02,90384102']]
dict_day = {}
list_a = [] list_b = [] for tmp in lis: tmp = tmp[0] list_a = tmp.split(',') a = list_a[0] b = list_a[1] list_b.append(a)dict_day.setdefault(a,[]).append(b)
list_max = []
dict_max = {} for i in list_b: list_r = [int(t) for t in dict_day[i]] list_r.sort(reverse=True) a = list_r[0] dict_max[i] = a list_max.append(a)for key in dict_day:
sorted_x = sorted(dict_max.iteritems(), key=lambda dict_max : dict_max[1], reverse=True)
list_sort = list(sorted_x)
list_1 = [list(i) for i in sorted_x] print list_1 for i in list_1: list_2 = [str(t) for t in i] print list_2[0]+","+list_2[1]print ','.join(list(sorted_x[0]))
list_max.sort(reverse=True)