0
我试图使用包含Unicode作为字典键的字符串,但我收到此错误:Unicode字符串作为关键的Python字典
print title
1 - Le chant du départ (Gallo, Max)
print repr(title)
'1 - Le chant du d\xc3\xa9part (Gallo, Max)'
d[title].append([infos,note])
KeyError: '1 - Le chant du d\xc3\xa9part (Gallo, Max)'
我们可以使用包含unicode字符的字符串作为关键字还是我们必须执行一些编码操作首先?
这应该有所帮助:http://stackoverflow.com/questions/11694821/dictionary-with-keys-in-unicode – Totem