Return to Snippet

Revision: 9893
at November 28, 2008 05:25 by deepdown


Initial Code
import sys
try:
    f = open('myfile.txt')
    s = f.readline()
    i = int(s.strip())
except IOError, (errno, strerror):
    print "I/O error(%s): %s" % (errno, strerror)
except ValueError:
    print "Could not convert data to an integer."
except:
    print "Unexpected error:", sys.exc_info()[0]
    raise

Initial URL
http://www.python.org/doc/2.5.2/tut/node10.html

Initial Description


Initial Title
Python Errors and Exceptions

Initial Tags
python

Initial Language
Python