Answers for "python os directory"

15

which folder python os

import os
cwd = os.getcwd()
Posted by: Guest on March-09-2020
0

python os is directory

import os.path
  
# Path
path = '/home/User/Documents/file.txt'
  
# Check whether the 
# specified path is an
# existing directory or not
isdir = os.path.isdir(path)
print(isdir)
  
  
# Path
path = '/home/User/Documents/'
  
# Check whether the 
# specified path is an
# existing directory or not
isdir = os.path.isdir(path)
print(isdir)
Posted by: Guest on March-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language