def write_csv(self,path,list_data_row):
with open(path, ‘w’,newline=’’) as f:
csv_write = csv.writer(f,dialect=‘excel’)
csv_write.writerow(list_data_row)
现在是刷新,重写
如果是追加写入,将第二行的w改成a
读取的时候
def read_csv(self,file_path):
with open(file_path,‘r’)as f:
csv_read=csv.reader(f)
for line in csv_read:
print(line)