Answers for "check the existence of a directory in python"

21

python check if folder exists

import os
print(os.path.isdir("/home/el"))
print(os.path.exists("/home/el/myfile.txt"))
Posted by: Guest on June-20-2020
0

check if path is a folder python

import os

# check the if the path is a directory
print(os.path.isdir("path"))

# check if the path is a file
print(os.path.isfile("path"))
Posted by: Guest on August-13-2021

Code answers related to "check the existence of a directory in python"

Python Answers by Framework

Browse Popular Code Answers by Language