Python 异常捕捉 try: f = open("hello.v","r") f.write("hello") except IOError: print("打开文件错误\n") else: print("打开文件成功\n") f.close()