我想仅在每行的第三帧中重写 csv 文件中的值。前两帧将是相同的。
但是在这段代码的输出中是
builtins.TypeError:'_csv.writer' 对象不可迭代
import csv
with open('friends.csv', mode='w') as file:
writer = csv.writer(file, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)
new_age = "25"
for line in writer:
writer.writerow(['line[0]','line[1]',new_age]) #it means that first two frmaes will be rewrited for same value like they are, last one will be rewrited to new_age.
你知道如何让它变得更好吗?
谢谢