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