pros and cons between os.path.exists vs os.path.isdir
os.path.exists
will also return True
if there's a regular file with that name.
os.path.isdir
will only return True
if that path exists and is a directory, or a symbolic link to a directory.
Just like it sounds like: if the path exists, but is a file and not a directory, isdir
will return False
. Meanwhile, exists
will return True
in both cases.