Skip to content

Instantly share code, notes, and snippets.

@martin-martin
Created July 12, 2021 13:50
Show Gist options
  • Select an option

  • Save martin-martin/6c9332e42a37f65ae3e814a94705f659 to your computer and use it in GitHub Desktop.

Select an option

Save martin-martin/6c9332e42a37f65ae3e814a94705f659 to your computer and use it in GitHub Desktop.

Revisions

  1. martin-martin created this gist Jul 12, 2021.
    14 changes: 14 additions & 0 deletions times.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    from pathlib import Path
    import re

    with open('outline.md', 'r') as f_in:
    content = f_in.read()

    # Finds all time mentions in the format shown below
    pattern = r'\((\d+)\smin\)' # (3 min)
    minutes = re.findall(pattern, content)

    # print([int(m) for m in minutes])

    total_time = sum([int(m) for m in minutes])
    print(total_time)