Python ord() 函数
本帖最后由 一个账号 于 2020-3-20 09:33 编辑Python ord() 函数
语法:
ord(c)
参数:
参数描述
c字符
返回值:
返回值是字符的ASCII码(十进制整数)
例子:
>>> ord('s')
115
>>> ord('a')
97
>>> ord('A')
65
>>> ord('1')
49
>>> ord('qiuyouzhi')
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
ord('qiuyouzhi')
TypeError: ord() expected a character, but string of length 9 found
>>> # 不能是多个字符
参数描述
NoneNone
一个账号 发表于 2020-3-20 09:27
你的代码复制是不是出问题了{:10_245:}
页:
[1]