我正在尝试读取一个完整的 csv 文件,在某一点对其进行更改并将其写回。
这是我的代码:
def change_Content(AttributIndex: int, content: str, title: str):
with open("Path.csv") as csvfile:
csv_reader = csv.reader(csvfile)
counter = 0
liste=[]
for row in csv_reader:
liste.append(list(row))
if row[0].__eq__(title):
list[counter][AttributIndex] = content
counter += 1
csv_writer = csv.writer(csvfile)
for row in liste:
csv_writer.writerow(row) # io.UnsupportedOperation: not writable