问题:在对csv进行写入操作时,write.writerow(["id","name","age","sex"]),出现了多余的换行符(如下图)
write.writerow(["id","name","age","sex"])
解决方法:特简单,在open()方法的参数里写入newline = ""即可
newline = ""
结果: