fopen = open('cleanding.csv', 'r') diff_line = fopen.readlines() line_list = [] for line in diff_line: line_list.append(line[:len(line)-1]) print(line_list) diff_match_split = [line_list[i:i + 100] for i in range(0, len(line_list), 100)] # 将
diff_line = fopen.readlines()
line_list = []
for line in diff_line:
line_list.append(line[:len(line)-1])
print(line_list)
diff_match_split = [line_list[i:i + 100] for i in range(0, len(line_list), 100)]
# 将文件切割
for i, j in zip(range(0, 11), range(0, 11)):
with open('wilson_split%d.csv' % j, 'w+') as temp:
for line in diff_match_split[i]:
temp.write(line+'\n')
将一个文件切割成10个文件