Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtroussard/0996c3d5085d51348650f7886b43af40 to your computer and use it in GitHub Desktop.
Save jtroussard/0996c3d5085d51348650f7886b43af40 to your computer and use it in GitHub Desktop.
import os
import json
import platform
file = "config.json"
if platform.system().lower() == "windows":
win_dir = "C:/Users/Public/appdata"
win_path = os.path.join(win_dir, file)
with open(win_path) as config_file:
config = json.load(config_file)
else:
linux_dir = "/etc/"
linux_path = os.path.join(linux_dir, file)
with open(linux_path) as config_file:
config = json.load(config_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment