python写入csv多了一个空行,加上newline=‘‘ 就可以了

with open('data.csv',mode='w',newline='',encoding='utf-8') as f:
    pass
今天在写入csv的时候发现文件多了一行空行,加上newline='' 就可以了

原:

python写入csv多了一个空行,加上newline=‘‘ 就可以了_第1张图片

 

你可能感兴趣的:(python,python,开发语言,后端)