Python import csv to list

后端 未结 13 1123
后悔当初
后悔当初 2020-11-22 06:15

I have a CSV file with about 2000 records.

Each record has a string, and a category to it:

This is the firs         


        
13条回答
  •  误落风尘
    2020-11-22 07:00

    If you are sure there are no commas in your input, other than to separate the category, you can read the file line by line and split on ,, then push the result to List

    That said, it looks like you are looking at a CSV file, so you might consider using the modules for it

提交回复
热议问题