def test_write(self):
fields=[]
fields.append(orderCode)
with open(r'./test001.csv', 'a',newline="") as f:
writer = csv.writer(f)
writer.writerow(fields)
Define a list: then add the data that needs to be written to the list
a #Append data to the next line
newline='' //Remove the blank lines in the middle of each line, if not added, there will be spaces between the lines
Add newline
do not add: