【发布时间】:2020-11-02 13:51:05
【问题描述】:
我需要将变量 sum 和 diff 的值导入到我的 test.csv 文件中,我该怎么做?我在下面留下我的代码:
x=3
y=5
z=2
sum=x + y + 5
diff= x-y-5
with open('test.csv', 'w', newline='') as f:
thewriter.writerow(['sum', 'diff'])
【问题讨论】:
标签: python csv export-to-csv