可能是python版本的问题
详情参见如下
#py2.7
filename='waiwai.txt'
try:
with open(filename) as f_obj:
contents=f_obj.read()
except FileNotFoundError:
print "Sorry,the file does't exist."
#py3.7
filename='waiwai.txt'
try:
with open(filename) as f_obj:
contents=f_obj.read()
except IOError:
print "Sorry,the file does't exist."