Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- ref = {1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'June', 7: 'July', 8: 'Aug', 9: 'Sept', 10: 'Oct', 11: 'Nov', 12: 'Dec'}
- birthdays = json.load(open('birthdays.json'))
- months_dict = {}
- for date in birthdays.values():
- items = date.split('/')
- month_n = int(items[1])
- name= ref[month_n]
- if name in months_dict.keys():
- months_dict[name] = months_dict[name] + 1
- else:
- months_dict[name] = 1
- print(months_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement