[Tutor] How to handle try and except in this case
Mic
o0MB0o at hotmail.se
Tue Nov 29 16:35:22 CET 2011
-----Ursprungligt meddelande-----
From: Dave Angel
Sent: Tuesday, November 29, 2011 4:25 PM
To: Mic
Cc: tutor at python.org
Subject: Re: [Tutor] How to handle try and except in this case
>(You top-posted again. Try to put your remarks AFTER the part you're
>quoting, so that the message is self-descriptive)
I did? I thought I posted this:
"""
>Could you explain what's unclear about it? Andreas couldn't get more
>specific, since you didn't say how these 10 names are provided.
Yes, it was probably my fault. Sorry about that. I have come up with a new
way of working around
a problem in my main program so I only need two files to be tested if they
exist instead of say 10 files. """
Is that top posting?
>The os.path.exists(filename) returns a boolean, and doesn't tie up
>resources, so you are welcome to use it in an if expression.
>if not (os.path.exists(file1) and os.path.exists(file2)):
>print "hi"
Thank you! What do you mean with that it "doesn't tie up resources"?
Mic
More information about the Tutor
mailing list