Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Cách lấy đường dẫn đầy đủ thư mục file hiện tại Python?


Để biết đường dẫn hoàn chỉnh file hiện tại dùng module os.

Ví dụ

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