Python 3 教程
Python3 內(nèi)置函數(shù)
ord() 函數(shù)是 chr() 函數(shù)(對(duì)于 8 位的 ASCII 字符串)的配對(duì)函數(shù),它以一個(gè)字符串(Unicode 字符)作為參數(shù),返回對(duì)應(yīng)的 ASCII 數(shù)值,或者 Unicode 數(shù)值。
以下是 ord() 方法的語法:
ord(c)
返回值是對(duì)應(yīng)的十進(jìn)制整數(shù)。
以下展示了使用 ord() 方法的實(shí)例: