擅长:python、mysql、java
<p>不,这只是源代码编码。请看<a href="http://www.python.org/dev/peps/pep-0263/" rel="nofollow">http://www.python.org/dev/peps/pep-0263/</a></p>
<blockquote>
<p>To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, such as:</p>
<pre><code> # coding=<encoding name>
or (using formats recognized by popular editors)
#!/usr/bin/python
# -*- coding: <encoding name> -*-
or
#!/usr/bin/python
# vim: set fileencoding=<encoding name> :
</code></pre>
</blockquote>
<p>这并不是说所有的文本都是unicode的,只是指出unicode文本应该如何解码。</p>
<p>应该使用<code>unicode</code>函数或<code>u</code>前缀将文字设置为unicode。</p>
<p>注意:在python3中,所有字符串都是unicode。</p>