Answers for "is directory in os"

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