Checking list by using of exception

TheSaint fc14301589 at icqmail.com
Sat Jun 14 11:29:54 CEST 2008


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 option
       myfile.readlines() # for example
-- 
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html



More information about the Python-list mailing list