python with as
2016-03-24 11:27
465 查看
参考:http://zhoutall.com/archives/325
开了文件就得关,
用 with as 就省了 finally
with-as表达式极大的简化了每次写finally的工作,这对保持代码的优雅性是有极大帮助的。
开了文件就得关,
用 with as 就省了 finally
相关文章推荐
- python的lambda表达式
- OMS开发(一):预览
- 多版本Python共存,以及pip对应
- ansible使用注意事项
- 安装完ActivePython后Python的Idle窗口打不开也卸载不掉的解决方法
- Python编码解码问题——常见错误
- Python学习笔记(二)Python的数据类型和变量
- python基础(6)--练习
- python基础(5)--正则表达式
- python基础(4)--文件对象,指针,os,os.path模块
- win10下安装python时出现的问题(这里以python3.4.3为例)
- python基础(3)--条件判断循环语句与列表解析,生成器
- python基础(2)--python函数
- python--基础学习(五)参数位置传递、关键字传递、包裹传递及解包裹
- python基础(1)--编译安装
- Python编码解码问题——开头两行
- HTCondor python bindings使用
- AWS s3 python sdk code examples
- python之enumerate函数使用
- python 错误: ImportError: cannot import name xxx