擅长:python、mysql、java
<p>是的,<code>email</code>包接口在很多时候并不是很有用。在</p>
<p>在这里,您必须在每个地址上手动使用<code>email.header.decode_header</code>,然后,因为这给了您一个解码令牌的列表,所以您必须再次手动将它们缝合在一起:</p>
<pre><code>for name, address in email.utils.getaddresses(addresses):
name= u' '.join(
unicode(b, e or 'ascii') for b, e in email.header.decode_header(name)
)
...
</code></pre>