← Go Back

How to Check if a Path Is a Directory

Using the os.path standard module:

>>> from os.path import isdir
>>> isdir("C:/Python312")
True
>>> isdir("C:/Python312/python.exe")
False


folders directories os.path


🐍 You might also find interesting: