Skip to content

Instantly share code, notes, and snippets.

@caglartoklu
Last active December 12, 2015 06:29
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 caglartoklu/4729951 to your computer and use it in GitHub Desktop.
Save caglartoklu/4729951 to your computer and use it in GitHub Desktop.
Displays the current module name and its path. #python #path
# http://docs.python.org/reference/datamodel.html?highlight=__file__
# Current module name
print __file__
# module1.py
# Path of the current module
import os
print os.path.abspath(os.path.dirname(__file__))
# /home/myusername/projects/project1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment