Answers for "python filename to folder and path"

1

python file location path

import os

print('getcwd:      ', os.getcwd())
print('__file__:    ', __file__)
Posted by: Guest on August-23-2020
0

python file directory

from os import path
dir_path = path.dirname(__file__)
Posted by: Guest on March-01-2021

Code answers related to "python filename to folder and path"

Python Answers by Framework

Browse Popular Code Answers by Language