同事说大文本文件好几个G打不开,写个程序分割下

#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: edit by infaaf
#   mail: [email protected]

# split big file per 10000

with open('source.txt') as f:
    linenum = 1
    filenum=1
    for line in f:
        if linenum >10000:
            linenum=1
            filenum+=1
        with open('sourcesplit_%s'%filenum,'a') as outf:
            outf.write(line.strip()+"\n")

        print("linenum: %s, filenum: %s"%(linenum,filenum))
        print(line.strip())
        linenum+=1