tobiah a écrit :
> 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"
>
Should be:
try:
f = open('noexists')
except IOError, e:
print >> sys.stderr, "Failed to open 'noexists' : %s" % e
--
http://mail.python.org/mailman/listinfo/python-list
