← Go Back

How to Check if a Path Is a File

Using the os.path standard module:

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


files os.path


🐍 You might also find interesting: