Dictionary with keys in unicode

后端 未结 2 2303
北海茫月
北海茫月 2021-02-20 02:53

Is it possible in Python to use Unicode characters as keys for a dictionary? I have Cyrillic words in Unicode that I used as keys. When trying to get a value by a key, I get the

2条回答
  •  青春惊慌失措
    2021-02-20 03:16

    Yes, it's possible. The error you're getting means that the key you're using doesn't exist in your dictionary.

    To debug, try printing your dictionary; you'll see the repr of each key which should show what the actual key looks like.

提交回复
热议问题