I have tried to convert an ascii string to an escaped pseudo unicode escaped string using python, but failed so far.
What I want to do: Convert ASCII ‘a’ to ASCII String “<U0061>“
I can convert “a” with unicode(‘a’), but can not safe the numerical value of a in an ascii string.
How can I do that?
You can use
ord()to convert a character to its character value (str) or code point (unicode). You can then use the appropriate string formatting to convert it into a text representation.