摘要: 在文本每行末尾加; 更好的写法 f = open(r'D:\test1\1.txt','rb') w = open(r'D:\test1\2.txt','wb') import os with f as lines: with w as outfile: for line in lines: lin 阅读全文
posted @ 2017-03-28 23:10 zhang.ning 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 1 import re 2 p = re.compile('AAAAAAAA',re.S) 3 f = open(r"D:\test\oldfile.txt","r").read() 4 paralist = p.split(f) 5 total_num = len(paralist) 6 for paraindex in range(total_num): 7 filewrit... 阅读全文
posted @ 2017-03-28 13:20 zhang.ning 阅读(2063) 评论(0) 推荐(0) 编辑