Python中关于with open file as 的用法
来源:互联网 发布:淘宝店价格表 编辑:程序博客网 时间:2024/06/05 00:19
最近用到python来处理文本文件了,然后需要处理文件。发现python中提供的with open as 这个还是用的不错的!好的,废话不多说了,看下例子:
with open('./sigir_title_cizu.txt') as cizu, open('sigir_title.txt') as titles:
cizuData = cizu.readlines()
titlesData = titles.readlines()
print(cizuData) #讲获取的内容打印出来
print(titlesData ) #讲获取的内容打印出来
用法是不是很简单呢?的确比较好用!
0 0
- Python中关于with open file as 的用法
- python 中关于with...as的用法
- python 中 with as的用法
- Python中with...as的用法
- python中 with...as的用法
- python中with as 用法
- python中 with as 用法
- python中with as 用法
- python的with...as...用法
- python with as的用法
- python with as的用法
- python的with open as f
- 关于oracle中 with xx as 的用法
- python之with open as
- Python--file 的with用法
- python with...as...用法
- python with...as用法
- python with...as...用法
- 第三章第10题
- A/B表替1对多关系,要求联合查询B表只提取一条与A记录关联的记录
- nyoj257郁闷的c小加(一)(栈和队列)
- UVA11806容斥原理,位运算排列,递推组合数
- <ARM嵌入式开发学习>我的第一个驱动程序-hello world
- Python中关于with open file as 的用法
- Custom SharePoint Web Template define element in onet.xml
- 完善-- iOS之键盘挡住输入框的解决方法
- HDU1075——What Are You Talking About
- Keepalived 安装与配置
- 关于IF判断的问题(一个有趣的事情)(分支-08. 高速公路超速处罚(15))
- hdu 1024 最大M子段和
- jquery的slideUp、slideDown函数在IE中bug解决办法
- 习题10-3 角度和正方形 UVa1643