Python ord() 函数

定义和用法

ord() 函数返回表示指定字符 unicode 编码的数字。

实例

返回表示字符 "E" 的整数:

x = ord("E")

运行实例

语法

ord(character)

参数

参数 描述
character 字符串,任何字符。