read and write on same csv file

前端 未结 5 1130
隐瞒了意图╮
隐瞒了意图╮ 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条回答
  •  [愿得一人]
    2020-11-30 11:28

    It is not possible to open the same file in two different modes in python.You have to release one of the file pointers with file_name.close() before opening the file in another mode!

提交回复
热议问题