如何在Python中获取当前文件目录的完整路径?

要了解当前文件的完整路径,请使用os模块。

例如

>>> import os
>>> print(os.path.realpath(__file__))
/home/ayush/qna/path.py