擅长:python、mysql、java
<p>同样在2.6(在python 2.6.5rc1+之前)中,unicode文本不能很好地处理关键字参数(<a href="http://bugs.python.org/issue4978" rel="noreferrer">issue4978</a>):</p>
<p>例如,以下代码在不使用unicode文本的情况下工作,但在使用unicode文本的情况下失败,出现TypeError:<code>keywords must be string</code>。</p>
<pre><code> >>> def foo(a=None): pass
...
>>> foo(**{'a':1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: foo() keywords must be strings
</code></pre>