How to get full path of current file's directory in Python?

PythonServer Side ProgrammingProgramming

To know the complete path to current file use the os module.

For example

>>> import os
>>> print(os.path.realpath(__file__))
/home/ayush/qna/path.py
raja
Published on 22-Dec-2017 09:59:33
Advertisements