how do you know if open failed?

tobiah toby at tobiah.org
Thu Sep 28 14:23:52 EDT 2006


SpreadTooThin wrote:
> f = open('myfile.bin', 'rb')
> 
> How do I know if there was an error opening my file?
> 
try:
         open('noexist')
except:
         print "Didn't open"

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list