擅长:python、mysql、java
<p>在python中,可以使用<a href="http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files" rel="nofollow">write</a>命令写入文件。<code>write()</code>将字符串的内容写入缓冲区。不要忘记使用<code>close()</code>函数关闭文件。你知道吗</p>
<pre><code>data = [1,2,3,4,5,6]
out = open("output.txt", "w")
for i in data:
out.write(str(i) + "\n")
out.close()
</code></pre>