Is it possible to use read_csv to read only specific lines?

前端 未结 4 609
天涯浪人
天涯浪人 2021-01-02 14:00

I have a csv file that looks like this:

TEST  
2012-05-01 00:00:00.203 ON 1  
2012-05-01 00:00:11.203 OFF 0  
2012-05-01 00:00:22.203 ON 1  
2012-05-01 00:00         


        
4条回答
  •  心在旅途
    2021-01-02 14:33

    When you get the row from the csv.reader, and when you can be sure that the first element is a string, then you can use

    if not row[0].startswith('TEST'):
        process(row)
    

提交回复
热议问题