python函数之chr(i)

巴扎黑
巴扎黑 原创
2017-08-21 13:43:40 3094浏览

chr(i)

中文说明:

返回整数i对应的ASCII字符。与ord()作用相反。

参数x:取值范围[0, 255]之间的正数。

版本:该函数在python2和python3各个版本中都可用。不存在兼容性问题。

英文说明:

Return a string of one character whose ASCII code is the integer i. For example, chr(97) returns the string 'a'. This is the inverse of ord(). The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range. See also unichr().

代码实例

>>> chr(97)
'a'
>>> chr(98)
'b'
>>> ord('a')
97
>>> ord('b')
98

ps:呵呵,这个函数和php里面的用法是一样的哦

以上就是python函数之chr(i)的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。