Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. [{u'month': u'7', u'stay_days': {u'value': 1.0}},
  2. {u'month': u'8', u'stay_days': {u'value': 1.0}},
  3. {u'month': u'9', u'stay_days': {u'value': 1.0}}]
  4.  
  5. arr = '''[ {
  6. "stay_days": {
  7. "value": 1.0
  8. },
  9. "month": "1"
  10. },
  11. {
  12. "stay_days": {
  13. "value": 1.0
  14. },
  15. "month": "2"
  16. },
  17. {
  18. "stay_days": {
  19. "value": 1.0
  20. },
  21. "month": "3"
  22. }]'''
  23. json_object = json.loads(arr)
  24. dt = datetime.strptime(datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f'), "%Y-%m-%dT%H:%M:%S.%f")
  25. month = dt.month
  26. months = []
  27. for line in json_object:
  28. months.append(line["key"])
  29. months
  30.  
  31. if (int(month) - int(max(months))) > 0 and (int(month) - int(max(months))) <= 3:
  32. for line in json_object:
  33. # ???
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement