D
D
Danil Samodurov2020-08-02 00:19:58
Python
Danil Samodurov, 2020-08-02 00:19:58

How to open a .csv file for reading and writing?

Hello. How to open a file with the .csv extension for reading and writing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-08-02
@samodurOFF

"r+"
Simple example:

with open('file.csv','r+') as file:
  
  data = file.readlines()
  print(data)

  file.write("test\n")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question