How can I break down a large csv file into small files based on common records by python

前端 未结 2 1198
谎友^
谎友^ 2021-01-29 14:18

What I want to do:

What I want to do is that I have a big .csv file. I want to break down this big csv file into many small files based on the common records in BB colum

2条回答
  •  没有蜡笔的小新
    2021-01-29 15:13

    You should look into the csv module. You can read your input file line by line and sort each line according to the BB column. This should be easy to do with a dictionary who's keys are the value in the BB column and the values are a list containing the information from that row. You can then write these lists to csv files using the csv module.

提交回复
热议问题