擅长:python、mysql、java
<p>Python控制台与终端一起工作,并根据其区域设置解释unicode编码。在</p>
<p>将该行替换为新的<code>str.format</code>:</p>
<pre><code>out = u"{} | {} | {} | {}\n".format(rpath, artist, album, title)
</code></pre>
<p>并在写入文件时编码为utf8:</p>
^{pr2}$
<p>或者<code>import codecs</code>并直接执行:</p>
^{3}$
<p>或者,由于utf8是默认值:</p>
<pre><code>with open('filelist.tmp', 'a') as f:
f.write(out)
</code></pre>