#每3000000行拆成一个文件
wdata = []
count = 0
with open('baike_triples.txt', 'r', encoding='utf8') as f:
d = f.readline()
while d:
if count%3000000==0:
print(count)
with open("pass_" + str(count) + ".txt", 'w+',encoding='utf-8') as f_target:
for mydata in wdata:
f_target.write(mydata)
wdata = []
count+=1
wdata.append(d)
d = f.readline()
python分割大型txt文件
最新推荐文章于 2024-05-10 14:31:12 发布