代码改变世界

随笔分类 -  txt

txt文件分解为固定条数的文件

2016-05-03 11:18 by LI桥IL, 242 阅读, 收藏,
摘要: #-*- coding: UTF-8 -*- # import linecache # count = linecache.getline(filename,linenum) # 读取文件某一行的内容 # str = linecache.getlines(filename) # str为列表形式,每一行为列表中的一个元素 import sys import linecache reload(s... 阅读全文

txt1-txt2去重输出到txt3

2016-05-03 10:55 by LI桥IL, 270 阅读, 收藏,
摘要: 1 # -*- coding: utf-8 -*- 2 # python 2.7 3 import sys 4 reload(sys) 5 sys.setdefaultencoding( "utf-8" ) 6 # 本方法用于对txt1中含有的txt2内容进行去重,并输出到txt3 7 # 由于文件输出,写入过程中有不可见编码,所以用strip()进行扫尾 8 def txt_q... 阅读全文