摘要: python是一种动态语言,变量不需要预先声明,因此我们可能常常会写出以下代码: ?View Code PYTHONtry: f = open('1.txt','r') s=f.read() except Exception as e: print e finally: f.close() 当1.txt存在时,这段代码能够正常运行,但是当f不存在导致异常时,运行finally代码块中的代码会抛出另... 阅读全文
posted @ 2011-08-17 12:23 KunZhu 阅读(158) 评论(0) 推荐(0) 编辑