摘要:
下面的是来自python help document的说明: Assert statements are a convenient way to insert debugging assertions into a program: assert语句是一种插入调试断点到程序的一种便捷的方式。 ass 阅读全文
摘要:
使用raise抛出异常 当程序出现错误,python会自动引发异常,也可以通过raise显式地引发异常。一旦执行了raise语句,raise后面的语句将不能执行。 演示raise用法。 try: s = None if s is None: print "s 是空对象" raise NameErro 阅读全文