擅长:python、mysql、java
<p>您必须将整数列表转换为strings<em>map()</em>上的列表,以使其可连接。在</p>
<pre><code>mylist = range(0,20+1,5)
f = open("test.txt", "w")
f.writelines(' '.join(map(str, mylist)))
f.close()
</code></pre>
<p>另请参见<a href="https://stackoverflow.com/questions/3590165/joining-list-has-integer-values-with-python">Joining List has Integer values with python</a></p>