摘要:
Python’s with statement provides a very convenient way of dealing with the situation where you have to do a setup and teardown to make something happe... 阅读全文
posted @ 2016-01-23 15:24
编程青年的崛起
阅读(643)
评论(0)
推荐(1)
摘要:
用 Python 做一件很平常的事情: 打开文件, 逐行读入, 最后关掉文件; 进一步的需求是, 这也许是程序中一个可选的功能, 如果有任何问题, 比如文件无法打开, 或是读取出错, 那么在函数内需要捕获所有异常, 输出一行警告并退出. 代码可能一开始看起来是这样的?12345678def read... 阅读全文
posted @ 2016-01-23 15:07
编程青年的崛起
阅读(1060)
评论(0)
推荐(0)

浙公网安备 33010602011771号