chr()、unichr()和ord()

2017-01-06  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读