open_diff = open('yanggao.txt', 'r',encoding='utf-8')
diff_line = open_diff.readlines() diff_match_split = [diff_line[i:i + 100] for i in range(0, len(diff_line), 100)] # 将切分的写入多个txt中
for i, j in zip(range(0, diff_match_split.__len__()), range(0, diff_match_split.__len__())):
with open('output%d.txt' % j, 'w+',encoding='utf-8') as temp:
for line in diff_match_split[i]:
temp.write(line)