Answers for "python absolute path of current file"

2

python get absolute path of file

>>> import os
>>> os.path.abspath("mydir/myfile.txt")
'C:/example/cwd/mydir/myfile.txt'
Posted by: Guest on June-02-2021
2

python get path of current file

import pathlib
pathlib.Path(__file__).parent.absolute()
Posted by: Guest on April-04-2020

Code answers related to "python absolute path of current file"

Python Answers by Framework

Browse Popular Code Answers by Language