Answers for "python os get directory"

17

python get current directory

import os

print(os.getcwd())
Posted by: Guest on March-02-2021
8

get directory of file python

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

os get current directory

import os

#Get Current working Directory
currentDirectory = os.getcwd()

#Change the Current working Directory
os.chdir('/home/varun')
Posted by: Guest on June-03-2020
2

python get current directory

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

python how to get directory of script

import os
print(os.path.abspath(''))
Posted by: Guest on December-04-2020

Code answers related to "python os get directory"

Python Answers by Framework

Browse Popular Code Answers by Language