1 csv file output using dict:
import csv
outFile = "VehOutData/OrderIdSumTime.txt"
outFileCsv = open(outFile,"w",newline='')
fileheader = ['orderid','otime']
outDictWriter = csv.DictWriter(outFileCsv,fileheader)
outDictWriter.writeheader()
result =[ {'orderid':'abc','otime':44555},{'orderid':'abc','otime':44555}]
outDictWriter.writerows(result)
outFileCsv.close()
Note the use of spaces in order to reduce the line
open(outFile,"w",newline='')
Note the use mode is not w wb, newline = '' non-control line
The use of the same content under python2.7 version, wb is not the same.
And explained: https://blog.csdn.net/pfm685757/article/details/47806469