Skip to content

Instantly share code, notes, and snippets.

@csytan
Created August 5, 2015 20:33
Show Gist options
  • Save csytan/c4784e2aa4f4d64ce0be to your computer and use it in GitHub Desktop.
Save csytan/c4784e2aa4f4d64ce0be to your computer and use it in GitHub Desktop.
Python Module Paths
import os
# Current working directory
print(os.getcwd())
# Module path (relative to cwd)
print(os.path.dirname(__file__))
# Abs path of the current module's directory
print(os.path.dirname(os.path.realpath(__file__)))
print(os.path.dirname(os.path.abspath(__file__)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment