[Tutor] try and file existence
boB Stepp
robertvstepp at gmail.com
Sun Aug 16 02:04:47 CEST 2015
On Sat, Aug 15, 2015 at 6:41 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Sat, Aug 15, 2015 at 02:24:21PM -0500, boB Stepp wrote:
>> 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?
>
> def print_file_names(possible_names):
> print("List of file names checked")
> print("--------------------------"
> for name in possible_names:
> if os.path.exists(name):
> print(name)
> else:
> print("missing:", name)
<Chuckle!>
Your example, giving about the most benign possible uses, is for emphasis?
boB
More information about the Tutor
mailing list