Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python open file check error

try:
    f = open(fname, 'rb')
except OSError:
    print "Could not open/read file:", fname
    sys.exit()

with f:
    reader = csv.reader(f)
    for row in reader:
        pass #do stuff here
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #open #file #check #error
ADD COMMENT
Topic
Name
3+1 =