try:
检测范围 #代码
except 错误代码 as reason:
print('文件出错了,原因是:' + str(reason))
finally: 这个命令可以在出错后依旧执行可以运行的代码
异常处理语句 try: 可以接else和with
try:
检测范围 #代码
except 错误代码 as reason:
print('文件出错了,原因是:' + str(reason))
finally: 这个命令可以在出错后依旧执行可以运行的代码
异常处理语句 try: 可以接else和with