Last active
June 19, 2021 18:07
-
-
Save johnathaningle/8cf6e8ece39b45ebbe7d20fe5b5f23ac to your computer and use it in GitHub Desktop.
Create Sample JSON data for SDEV400's Homework 4 Assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from datetime import datetime | |
from random import randint | |
if __name__ == "__main__": | |
item = { | |
"Name": f"Trip: {datetime.now()}", | |
"Distance": randint(1, 100), | |
"Time": str(datetime.now()), | |
"Speed": randint(11, 19) | |
} | |
file_name = str(datetime.today()).replace(":", "").replace(".", "") | |
with open(f"{file_name}.json", "w") as outfile: | |
outfile.write(json.dumps(item)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment