Re: Checking list by using of exception

2008-06-14 Thread TheSaint
On 15:37, venerdì 13 giugno 2008 Nader wrote: > try: > list_of_files != [] > get the files > For file in list_of_files: try: myfile = open(file, 'r') except (IOError, OSError): print"Your %s file wasn't open" %file # here you can do something with your open file as read

Re: Checking list by using of exception

2008-06-13 Thread Nader
On Jun 13, 11:34 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 13 Jun 2008 04:37:44 -0300, Nader <[EMAIL PROTECTED]> escribió: > > > 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 i

Re: Checking list by using of exception

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 04:37:44 -0300, Nader <[EMAIL PROTECTED]> escribió: 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 != ""

Checking list by using of exception

2008-06-13 Thread Nader
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: