python学习笔记十:异常

一、语法#!/usr/bin/pythonfilename=hello#try except finally demotry:open(abc.txt)print helloexcept IOError,msg:print the file not existexcept NameError,msg:print hello not definedfinally:print end#throw exceptionif filename == hello:raise Ty

返回顶部