Skip to content

Instantly share code, notes, and snippets.

@nerdinand
Created March 16, 2023 14:19
Show Gist options
  • Save nerdinand/ad5b8ff3b41bf2f2d9f712ccd65f1ba6 to your computer and use it in GitHub Desktop.
Save nerdinand/ad5b8ff3b41bf2f2d9f712ccd65f1ba6 to your computer and use it in GitHub Desktop.
Quick and dirty env.sh file reading and applying in Python (useful for example in a Jupyter Notebook)
import re
import os
for m in re.finditer(r'export (.*)=([^ \n]+)', open('../env.sh').read()):
os.environ[m[1]] = m[2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment