Verified Input.
Grant Edwards
grante at visi.com
Thu Oct 18 11:06:05 EDT 2001
In article <4783f0eb.0110171949.125344dc at posting.google.com>, Alec D. Cheah wrote:
> How do verified from input the variable entered is a file or a
> path and how do you check whether it exist or not??
Others have already answered your question.
We will now address the meta-question...
Some might say that one might not want to directly check such
things. One just opens the file and reads it. If the file
doesn't exist or can't be read, then an exception will be
raised. If you handle such exceptions properly, then you don't
have to add code to check the path before you open it.
If you've never worked in a language with error-handling
facilities, it's something worth thinking about (even if
checking beforehand turns out to be what you want to do).
--
Grant Edwards grante Yow! That's a decision
at that can only be made
visi.com between you & SY SPERLING!!
More information about the Python-list
mailing list