擅长:python、mysql、java
<p>CSV文件只是txt文件,因此您可以执行以下操作:</p>
<pre><code>...
with open("shop.csv", "w") as fout: #< added this
fout.write("fruits,veggies\n") #< added this
for x, y in zip(fruits,veggies):
fout.write(f'{x},{y}\n') #< added this
</code></pre>
<p>运行代码后,您将发现一个名为<code>shop.csv</code>的新csv文件,它有两列:<code>fruits</code>和<code>veggies</code></p>