Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import json
  2.  
  3. 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'}
  4.  
  5. birthdays = json.load(open('birthdays.json'))
  6. months_dict = {}
  7.  
  8. for date in birthdays.values():
  9. items = date.split('/')
  10. month_n = int(items[1])
  11. name= ref[month_n]
  12. if name in months_dict.keys():
  13. months_dict[name] = months_dict[name] + 1
  14. else:
  15. months_dict[name] = 1
  16. print(months_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement