chr()、unichr()和ord()
作者:
梦归游子意 | 来源:发表于
2017-01-06 11:59 被阅读0次>>> chr(65)
'A'
>>> ord('a')
97
>>> unichr(12345)
u'\u3039'
>>> chr(12345)
Traceback (most recent call last):
File "", line 1, in ?
chr(12345)
ValueError: chr() arg not in range(256)
>>> ord(u'\ufffff')
Traceback (most recent call last):
File "", line 1, in ?
ord(u'\ufffff')
TypeError: ord() expected a character, but string of length 2 found
>>> ord(u'\u2345')
9029
本文标题:chr()、unichr()和ord()
本文链接:https://www.haomeiwen.com/subject/ahjzvttx.html
网友评论