擅长:python、mysql、java
<p>我不确定我是否完全理解你的问题。</p>
<p>但有时这可以解决问题:</p>
<pre><code>import sys
reload(sys)
setdefaultencoding('utf-8')
</code></pre>
<p>或者尝试通过应用编码格式打开文件。例如:</p>
<pre><code>import codecs
with codecs.open(filename, 'r3', encoding='utf-8') as fd:
do something.
</code></pre>