Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

try for loop python

try:   
    with open('sample.txt','r') as file:
        for line in file:
            (some action here)
except IOError:
    except IOError as (errno, strerror):
        print "I/O error({0}): {1}".format(errno, strerror)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #python
ADD COMMENT
Topic
Name
2+5 =