← Go Back
How to Check if a Path Is a Directory
Using theos.path
standard module:>>> from os.path import isdir
>>> isdir("C:/Python312")
True
>>> isdir("C:/Python312/python.exe")
False
🐍 You might also find interesting: