how to check if a file is a directory or regular file in python? [duplicate] how to check if a file is a directory or regular file in python? [duplicate] python python

how to check if a file is a directory or regular file in python? [duplicate]


os.path.isfile("bob.txt") # Does bob.txt exist?  Is it a file, or a directory?os.path.isdir("bob")


Many of the Python directory functions are in the os.path module.

import osos.path.isdir(d)


matomo