擅长:python、mysql、java
<p>使用<a href="http://docs.python.org/tutorial/introduction.html#unicode-strings">Unicode strings</a>:</p>
<pre><code># Encoding: UTF-8
japanese = u"桜の花びらたち"
print japanese
print len(japanese)
</code></pre>
<p>注意字符串前面的<code>u</code>。</p>
<p>要将bytestring转换为Unicode,请使用<code>decode</code>:<code>"桜の花びらたち".decode('utf-8')</code></p>