我在为一个命名元组分配Unicode字符串作为名称时遇到了问题。以下方式可行:
a = collections.namedtuple("test", "value")
而这个则不行:
b = collections.namedtuple("βαδιζόντων", "value")
I get the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.4/collections/__init__.py", line 370, in namedtuple
result = namespace[typename]
KeyError: 'βαδιζόντων'
为什么会这样呢?文档上说,“Python 3也支持在标识符中使用Unicode字符”,而且关键字是有效的Unicode吗?