You're looking for os.path.isdir, or os.path.exists if you don't care whether it's a file or a directory.

Example:

import os
print(os.path.isdir("/home/el"))
print(os.path.exists("/home/el/myfile.txt"))