python often get some string, but when we need to be calculated first convert it to an integer.
Because I just returned from microcontroller programming to python, a soft spot for the ASCII code, so tell us about the ASCII conversion functions corresponding characters.
the ord () function is used to return a single character ascii value (0-255). E.g:
>>> ord('d')
100
>>> ord('5')
53
Conversely, CHR () function is an input an integer [0,255] ascii Returns the corresponding symbol, for example:
CHR >>> (100)
'D'
>>> CHR (53 is)
'. 5'
The following presents a conversion code for a character string:
print("hello i am bob") a=5;b=2 c=a//b c='8' c=ord(c) print("%x"%(c))
The results are as follows:
hello i am bob 38
Here in the sixth line indicates hexadecimal% x, '8' corresponding to the ASCII code 0x38