![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python实战
Bilychen技术不止于此
这个作者很懒,什么都没留下…
展开
-
01- python文件操作“读写”“编辑”
python txt文件常用读写操作 文件的打开的两种方式 1 f = open("data.txt","r") #设置文件对象 2 f.close() #关闭文件 3 4 5 #为了方便,避免忘记close掉这个文件对象,可以用下面这种方式替代 6 with open('data.txt',"r") as f: #设置文件对象 7 str = f.read(...原创 2018-11-27 15:00:25 · 136 阅读 · 0 评论 -
02-数据操作【读、写、拼接、清洗、函数封装】
def read24list(file): """ 读取24条已有的数据列表 """ data = [] list24 = [] getIndex24 = [] # 方法2: with优化文件操作 with open (file, "r", encoding="UTF-8") as fileName: line = fileNa...原创 2018-11-27 15:07:56 · 128 阅读 · 0 评论