Computer >> Computer tutorials >  >> Programming >> Python

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


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