Python3 ord() º¯Êý
ÃèÊö
ord() º¯ÊýÊÇ chr() º¯Êý£¨¶ÔÓÚ 8 λµÄ ASCII ×Ö·û´®£©µÄÅä¶Ôº¯Êý£¬ËüÒÔÒ»¸ö×Ö·û´®£¨Unicode ×Ö·û£©×÷Ϊ²ÎÊý£¬·µ»Ø¶ÔÓ¦µÄ ASCII ÊýÖµ£¬»òÕß Unicode ÊýÖµ¡£
Óï·¨
ÒÔÏÂÊÇ ord() ·½·¨µÄÓï·¨:
ord(c)
²ÎÊý
- c -- ×Ö·û¡£
·µ»ØÖµ
·µ»ØÖµÊǶÔÓ¦µÄÊ®½øÖÆÕûÊý¡£
ʵÀý
ÒÔÏÂչʾÁËʹÓà ord() ·½·¨µÄʵÀý£º
>>>ord('a')
97
>>> ord('€')
8364
>>>