read and write on same csv file

前端 未结 5 1148
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 11:00

I am trying to read and write on the same CSV file:

file1 = open(file.csv, \'rb\')
file2 = open(file.csv, \'wb\')
read         


        
5条回答
  •  萌比男神i
    2020-11-30 11:24

    If your csv file is not big enough(to explode the memory), read it all into memory and close the file before open it in write mode.

    Or you should consider writing to a new file rather than the same one.

提交回复
热议问题