Answers for "os module check if something is a folder"

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

Code answers related to "os module check if something is a folder"

Python Answers by Framework

Browse Popular Code Answers by Language