Answers for "python relative path to absolute"

2

get full path of file python

>>> import os
>>> os.path.abspath("mydir/myfile.txt")
'C:/example/cwd/mydir/myfile.txt'
Posted by: Guest on December-24-2020
1

relative path python

import sys,os
sys.path.append(os.path.realpath('..'))
Posted by: Guest on February-09-2021
0

python relative path

import os
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'relative/path/to/file/you/want')
Posted by: Guest on July-29-2021

Code answers related to "python relative path to absolute"

Python Answers by Framework

Browse Popular Code Answers by Language