All types in Python exist as objects.
There is no char type in Python, only a string type, which makes it very inconvenient for us to convert the char type to integer, but Python already provides built-in functions for these transformations.
In Python, in addition to Integer, the other binary can only be represented by a string.
1 int ()
Binary, octal, 16-binary can be converted to decimal integer
>>> int (' 1111 ', 2) 15>>> int (' F ', +) 15>>> int (' 17 ', 8) 15
2 Chr ()
Convert an integral type to a character
>>> chr ' Z '
3 Ord ()
Convert a character to an integral type
>>> Ord (' Z ') 90
4 Hex ()
Convert decimal to hexadecimal
>>> Hex (255) ' 0xFF '
5 Oct ()
Convert Decimal to Octal
>>> Oct (255) ' 0377 '
6 bin ()
Convert decimal into binary
>>> Bin (255) ' 0b11111111 '
Conversion of various underlying types in Python, binary, octal, decimal, hex