Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My format is

MM/DD/YYYY (i.e. 1/1/2025)

$sets x $reps $weight $name (i.e. 3x10 135 Bench Press)

I uploaded the log file to ChatGPT and had it spit out a Python script to parse into JSON:

``` for line in file:

    date_match = re.match(r'^(\d{1,2}/\d{1,2}).\*?$', line.strip())
    if date_match:
        # construct a new workout entry 
        # continue

    exercise_match = re.match(r'^(\d+)x(\d+)\s+(\d+)\s+(.+)$', line.strip())
    if exercise_match:
        # insert new exercise into current workout
        # continue
```


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: