Opening a Nonexistent File : Open : File PYTHON TUTORIALS


PYTHON TUTORIALS » File » Open »

 

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"



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo File
» Open