def chr(*args, **kwargs): """ Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff. """
def ord(*args, **kwargs): """ Return the Unicode code point for a one-character string. """
chr(i)
返回十进制整数i对应的ASCII字符。与ord()作用相反。
参数i:取值范围[0, 255]之间的正数。
print(chr(97)) # 结果 a print(ord(‘a‘)) # 结果 97
时间: 2024-10-05 12:13:17