Question: I have a list of dictionaries

```
d = [{"Date": "2020/10/03 3:30", "Name": "John"}, {"Date": "2020/10/03 5:15", "Name": "Harry"}, {"Date": "2020/10/05 6:30", "Name": "Rob"}]

```

and I want to only print the name with the same dates.

```
Output:
John
Harry

```

I am not sure how I can implement this, any tips ?

Answer: 
Your problem can easily be solved by traversing the list of entries and collecting the dates with the names in a new dictionary. So, you use the dates as key for a dictionary and add the names in a corresponding list of that date. I'm adding a code snippet that does that fairly easily:

```
d = [{"Date": "2020/10/03 3:30", "Name": "John"}, {"Date": "2020/10/03 5:15","Name": "Harry"}, {"Date": "2020/10/05 6:30", "Name": "Rob"}]

dates = {}

for entry in d:
    date = entry["Date"].split()[0]
        if date in dates:
            dates[date].append(entry["Name"])
        else:
            dates[date] = []
            dates[date].append(entry["Name"])

print(dates["2020/10/03"])
print(dates["2020/10/05"])

```

Yes, I know my code snippet doesn't directly provide your specified output. I kept it open ended so you can tailor it towards your specific needs.
You can extract dates and then sort and group by them.

```
from datetime import datetime
from itertools import groupby

```

This is a helper function for extracting the date from a dictionary:

```
def dategetter(one_dict):
    return datetime.strptime(one_dict['Date'], 
                             "%Y/%m/%d %H:%M").date()

```

This is a dictionary comprehension that extracts, sorts, groups, and organizes the results into a dictionary. You can print the dictionary data in any way you want.

```
{date: [name['Name'] for name in names] for date,names 
       in groupby(sorted(d, key=dategetter), key=dategetter)}
#{datetime.date(2020, 10, 3): ['John', 'Harry'], 
# datetime.date(2020, 10, 5): ['Rob']}

```