Skip to content

Instantly share code, notes, and snippets.

@uschille
uschille / extract_code.py
Last active April 14, 2023 00:29 — forked from bobturneruk/extract_code.py
pulls code out of carpentries episodes - not the most reliable!
import sys
import os
import re
path = os.path.dirname(sys.argv[1])
path = "." if path == "" else path
episode = os.path.splitext(os.path.basename(sys.argv[1]))[0]
with open(f"{path}/{episode}.md") as f:
content = f.read()