from collections import defaultdict dates_dict = defaultdict(list) for key, date in cur: dates_dict[key].append(date)