special Chinese characters comparison [closed]

我怕爱的太早我们不能终老 提交于 2019-12-14 03:36:09

问题


. There are something misunderstanding when comparing two characters "李","李".

>>> "李" == "李"
False

>>> id("李") # fisrt one
140041303457584

>>> id("李") # second one
140041303457584

. The first character "李“ id is equal to the second "李" id, but when i try to compare their id to see what happen:

>>> id("李") == id("李")
False

. However, I tried to use chrome "Ctrl + F" that searching the first "李" and matched the second "李".

. Does anyone know what happens? what should I do to fix this let the first "李" equal to the second "李"?


回答1:


I think it's just a coincidence that two character looks the same. like:

>>> "ᴀ" == "A"
False
>>> "С" == "C"
False

Visit unicode table, and you will find that the first character(unicode: 674e) is the normal character of Chinese, the second one(unicode: f9e1) is a special character that happends to look like the same. But they are indeed different characters.



来源:https://stackoverflow.com/questions/55488577/special-chinese-characters-comparison

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!