To check if a path is a Directory in Python you can use the snippet below.

Sample Python

import os

print(os.path.isdir("/myfolder/folder1"))

3 thought on “How to check if a path is a Directory in Python”

Leave a Reply