Python Latin-1 对十进制的补充
Python Latin-1 Supplement to decimal
和python
ord('a')
给予
97
但是
ord('é')
报错
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ord() expected a character, but string of length 2 found
如何像 https://en.wikipedia.org/wiki/List_of_Unicode_characters#Latin-1_Supplement 那样获取除 ASCII (é = 233) 以外的其他字母的小数点?
你可以先解码:
ord('é'.decode('utf-8')) # outputs 233
和python
ord('a')
给予
97
但是
ord('é')
报错
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ord() expected a character, but string of length 2 found
如何像 https://en.wikipedia.org/wiki/List_of_Unicode_characters#Latin-1_Supplement 那样获取除 ASCII (é = 233) 以外的其他字母的小数点?
你可以先解码:
ord('é'.decode('utf-8')) # outputs 233