python获得字符的ASCII码,将ASCII数字转换为字符,pythonascii,下面的代码可以在字符和a


下面的代码可以在字符和ascii码之间互转。

# Get the ASCII number of a characternumber = ord(char)# Get the character given by an ASCII numberchar = chr(number)

如果是Unicode字符,可以使用ord()和unichr()函数。

评论关闭