Advertisement
KodingKid

How to use dictionaries/JSON in Python + calculating a past (+ does future) date using DeltaTime

Jun 24th, 2021
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import date
  2. import time
  3. import datetime
  4. import timedelta
  5. today = datetime.datetime.now()
  6. dict1 = {
  7.     "name": "player_1"
  8.     "date": "27/12/2020"
  9. }
  10. age = str(datetime.now() - timedelta(days=27, weeks=0, months=11, year=0)) #will always calculate the day the script is ran on, minus the date the account was made
  11. print(dict1["name"])
  12. print(dict1["date"])
  13. print(age)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement