Python : Get absolute path of script
2019, November, 29
PythonCode
import osos.path.dirname(os.path.realpath(__file__))
- file refers to current file. This does not work in python interactive shell
- os.path.realpath(file) gives absolute path of current file.
- os.path.dirname removes last element from path