python get absolute path of current file code example
Example 1: python get absolute path of file
>>> import os
>>> os.path.abspath("mydir/myfile.txt")
'C:/example/cwd/mydir/myfile.txt'
Example 2: python file location path
import os
print('getcwd: ', os.getcwd())
print('__file__: ', __file__)