Mega Code Archive
Categories
/
Python Tutorial
/
File
Opening a Nonexistent File
fsock = open("notthere.txt", "r") try: fsock = open("notthere.txt") except IOError: print "The file does not exist, exiting gracefully" print "This line will always print"