current path of python file code example
Example 1: get path to current directory python
import os
os.path.abspath(os.getcwd())
Example 2: python file location path
import os
print('getcwd: ', os.getcwd())
print('__file__: ', __file__)
import os
os.path.abspath(os.getcwd())
import os
print('getcwd: ', os.getcwd())
print('__file__: ', __file__)