Reputation: 1851
I would like to know how to change a keyboard key's character to it's hex value. For example:
Key A: 0x41
Key B: 0x42
Key P: 0x80
Key Z: 0x5A
http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html
The link above also has a list of the base 10 numbers for each key code, but I need those base 10 numbers converted to hex. Is there any easy way to just do something like this?
>>> toHex("b")
0x42
Upvotes: 0
Views: 3180
Reputation: 114038
you can get the ascii value of any character with ord
ord("B")
you can convert any number to hex representation with hex
hex(77)
Upvotes: 2