In Bash, the
[ -f ] and
[ -d ] tests can test whether a file or a directory exist. What are the corresponding python method for these tests?
Return True if path is an existing regular file. This follows symbolic links.
Return True if path is an existing directory. This follows symbolic links.
As they follow symbolic links (in Bash,
-f do too), if you are interested filter symbolic links out, you can use
Return True if path refers to a directory entry that is a symbolic link. Always False if symbolic links are not supported by the python runtime.