Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Python get abs path

16 Sep 2020 » programming

https://stackoverflow.com/questions/5183601/how-to-get-the-current-running-module-path-name/8789689

import os
abspath = os.path.dirname(os.path.realpath(__file__))
import os

print (__file__)
print (os.path.abspath(__file__))
print (os.path.realpath(__file__))
print (os.path.dirname(os.path.realpath(__file__)))