会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
代码改变世界
Cnblogs
Dashboard
Login
Home
Contact
Gallery
Subscribe
RSS
风依然
随笔档案-2016年02月
Python 的with语句
2016-02-18 14:53 by 风依然, 207 阅读,
收藏
,
摘要: 1、使用 with 语句操作文件对象 with open(r'somefileName') as somefile: for line in somefile: print line # ...more code 这里使用了 with 语句,不管在处理文件过程中是否发生异常,都能保证 with 语句
阅读全文
0 Comment
About