【发布时间】:2016-01-28 15:34:30
【问题描述】:
如何将其更改为打印到 CSV 文件而不是文本文档。
name = billy
score = 69
f.write('Name: %s || Score: %i\n' % (name, score))
【问题讨论】:
-
“而不是文本文档”是什么意思?改变 ||到,?
-
csv是文本。 -
将
with open("my-text.txt", "w") as f:更改为with open("my-text.csv", "w") as f:
标签: python python-3.x export-to-csv