Python 3 教程教程
Python3 ord() 函数
Python3 ord() 函数
Python3 ord() 函数
Python3 内置函数描述
ord() 函数是 chr() 函数(对于 8 位的 ASCII 字符串)的配对函数,它以一个字符串(Unicode 字符)作为参数,返回对应的 ASCII 数值,或者 Unicode 数值。
语法
以下是 ord() 方法的语法:
ord(c)
参数
- c -- 字符。
返回值
返回值是对应的十进制整数。
实例
以下展示了使用 ord() 方法的实例:
>>>ord('a')
97
>>> ord('€')
8364
>>>
Python3 ord() 函数 |
---|
Python 3 教程
Python的3.0版本,常被称为Python 3000,或简称Py3k。相对于Python的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0在设计的时候没有考虑向下兼容。