Jan-28-2020, 03:30 AM
if my function gets a single character that is str or bytes or bytearray, there is a simple way to convert its character code.
i want the same type as i originally had because this conversion is because i need to do changes to the character that are done as a numeric code. Unicode is not involved. all characters are ASCII only even for type str.
what's a good way to convert back to the original character type?
ord()
works for all 5 types, so thats easy. going the other way has to be harder because of which type you want to go to. chr()
get str.i want the same type as i originally had because this conversion is because i need to do changes to the character that are done as a numeric code. Unicode is not involved. all characters are ASCII only even for type str.
what's a good way to convert back to the original character type?