python ASCII - KerwinKoo/KerwinKoo.github.io GitHub Wiki
# Get the ASCII number of a character
number = ord(char)
# Get the character given by an ASCII number
char = chr(number)如果是Unicode字符,可以使用ord()和unichr()函数。
例:
import ctypes
>>>i = c_int(45)
>>>i.value
45
>>> a = "{'a': 'hi', 'b': 'there'}"
>>> b = eval(a)
>>> b
{'a': 'hi', 'b': 'there'}
>>> exec ("c=" + a)
>>> c
{'a': 'hi', 'b': 'there'}
>>>