[Tutor] os.path Query
Eryk Sun
eryksun at gmail.com
Sun Feb 7 10:47:49 EST 2021
On 2/7/21, Alan Gauld via Tutor <tutor at python.org> wrote:
>
> exists(something)
>
> tells you if something exists in your filesystem.
> It gives no clue what something is - a drive, a folder, a file or a
> shortcut.
>
> isfile(something)
>
> tells you if something both exists and is a file.
> And only a file, anything else will be false.
Note that both of these tests are both based on os.stat() calls that
traverse symlinks in POSIX, and any type of reparse point in Windows
(e.g. symlinks, mountpoints). Thus they don't test whether "something"
is a symlink.
More information about the Tutor
mailing list