Last active
January 8, 2020 01:03
-
-
Save nijave/e75eaa0b6c77566d09292a95b153e517 to your computer and use it in GitHub Desktop.
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 | |
import re | |
with open("AARON1.DAT", "r") as f: | |
workoutfile = f.read().strip() | |
workouts_json = "[" + workoutfile.replace(" }\n}\n{", "},\n{").replace("}\n{", "},\n{").strip()[0:-1] + "]" | |
try: | |
workouts = json.loads(workouts_json) | |
except json.decoder.JSONDecodeError as e: | |
print("Failed to parse line %i" % e.lineno) | |
print("\n".join(workouts_json.splitlines()[e.lineno-1:e.lineno+2]).encode("unicode_escape").decode("ascii")) | |
from pprint import pprint | |
user_data = workouts.pop(0) | |
pprint(workouts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment