Last active
December 12, 2015 06:29
-
-
Save caglartoklu/4729951 to your computer and use it in GitHub Desktop.
Displays the current module name and its path. #python #path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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