[Tutor] try and file existence

Laura Creighton lac at openend.se
Sat Aug 15 23:49:28 CEST 2015


In a message of Sat, 15 Aug 2015 14:24:21 -0500, boB Stepp writes:
>I understand your points, but wonder then what is the intended use for
>os.path.exists()?  That is, in what types of circumstances would it be
>both appropriate and safe to use?
>
>boB

If you want to locate dangling symlinks,  os.path.exists
will return False, so the symlink is there, but the file it pointed to
is long gone.

Laura



More information about the Tutor mailing list