代码语言:javascript复制
# 读取总txt文件
open_diff = open('diff_match_image.txt', 'r')
diff_line = open_diff.readlines()
line_list = []
for line in diff_line:
line_list.append(line)
# print(line_list)
#切分diff
diff_match_split = [line_list[i:i 100] for i in range(0,len(line_list),100)]
#将切分的写入多个txt中
for i,j in zip(range(0,13),range(0,13)):
with open('diff_match%d.txt'% j,'w ') as temp:
for line in diff_match_split [i]:
temp.write(line)