Hello,
I read some files name from a directory and then I put these name in a
list. I will check whether it is empty or not, and I would do it with
an exception. With if statement it is very simple:
If list_of_files != "" : # this can be if list_of_files !=
[]:
get the files
elas:
there is no file
But with exception, I can write something as:
try:
list_of_files != []
get the files
except ValueError:
Print " there is no file"
What can the first statement be inside 'try' if I don't want to use if
statement?
Maybe my understandig of exception is enough to got it.
Would somebody explain me about this?
Regards,
Nader
try and except in a dircMaybe this quetion will be simple enough for
you.