python - Python - 向 csv 文件添加新行
问题描述
我将新数据附加到 csv 文件中,它添加了信息。下次它添加它时,它错过了一行。我怎样才能让它不会错过一排?(所以它直接附加在最后一条数据的下方?)
当我在 Excel 上打开文件时,它显示为:Laura 99
(额外行)
劳拉 99
代替:
劳拉 99
劳拉 99
import csv
with open ("scoreboard.csv", "a") as csvfile:
writer = csv.writer(csvfile)
writer.writerow(["Laura", "99"])
print ("The New score has been added to the score sheet")
解决方案
推荐阅读
- square - 如何从 Square API 获取最近的销售额?
- mxgraph - mxGraph:当我删除所有单元格时,布局管理器停止工作
- java - 将 AsyncTask 重置为多次执行
- angular - 为什么订阅函数中的代码会执行多次
- html - 当 flex-direction 设置为 column 时,如何使用 flexbox 将元素与 div 的底部对齐
- angular - ngx-translate 刷新页面后切换到默认语言
- django - 为 django 建模 ER 图
- c# - 区域顶点在 Eyeshot 上略有不同
- c# - 是否建议在 Windows 服务中运行 Visual Studio Tools for Office?
- mule - 如何解决 Anypoint studion 7 错误?