python3-分割文本文件

2020-01-08 11:19:25 浏览数 (1)

代码语言:javascript复制
#myhaspl@myhaspl.com
fId=1
with open("tf-allsrc.txt","r") as sf: 
    while True:
        with open("tf-src-" str(fId) ".txt","w ") as f:
            data=sf.read(1024*1024*5)
            if not data:
                break
            f.write(data)
            print(fId,"#",end=".")
        fId =1

0 人点赞