os.isdir

The os.isdir function checks for the existence of directory.

os.isdir("path")

Parameters

Path is the file system path to check.

Return Value

True if a matching directory is found; false is there is no such file system path, or if the path points to a file instead of a directory.