Created
June 11, 2012 23:49
-
-
Save anonymous/2913468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
try: | |
f = open('myfile.txt') | |
s = f.readline() | |
i = int(s.strip()) | |
except IOError as e: | |
print "I/O error({0}): {1}".format(e.errno, e.strerror) | |
except ValueError: | |
print "Could not convert data to an integer." | |
except: | |
print "Unexpected error:", sys.exc_info()[0] | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment