splitting one csv into multiple files in python

前端 未结 10 2114
执念已碎
执念已碎 2020-12-05 07:28

I have a csv file of about 5000 rows in python i want to split it into five files.

I wrote a code for it but it is not working

import codecs
import c         


        
10条回答
  •  爱一瞬间的悲伤
    2020-12-05 07:57

    @Ryan, Python3 code worked for me. I used newline='' as below to avoid the blank line issue:

    with open(target_filepath, 'w', newline='') as target:
    

提交回复
热议问题