Answers for "python get directory of the running python file"

9

get directory of file python

import os 
dir_path = os.path.dirname(os.path.realpath(__file__))
Posted by: Guest on April-03-2020
0

python find directory of file

import os
  
print('File name :    ', os.path.basename(__file__))
print('Directory Name:     ', os.path.dirname(__file__))
Posted by: Guest on January-10-2022

Code answers related to "python get directory of the running python file"

Python Answers by Framework

Browse Popular Code Answers by Language