Remove a single row from a csv without copying files

后端 未结 7 2254
青春惊慌失措
青春惊慌失措 2020-12-06 00:07

There are multiple SO questions addressing some form of this topic, but they all seem terribly inefficient for removing only a single row from a csv file (usually they invol

7条回答
  •  执念已碎
    2020-12-06 00:42

    This might help:

    with open("sample.csv",'r') as f:
        for line in f:
            if line.startswith('sarah'):continue
            print(line)
    

提交回复
热议问题