python common decimal, hexadecimal conversion between

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44266650/article/details/99719290

Hexadecimal conversion between integer:

hex (16) # 10 hex 16 hex turn
oct (8) # 10 revolutions decimal octal
bin (8) # 10 transfer binary decimal

Two string to Integer

'is converted into a string of 10 hexadecimal integer # int ('10)
int (' 10 ', 16) # hexadecimal string into an integer
int (' 0x10 ', 16) # hexadecimal string into an integer
int ( '10', 8) # octal string into an integer
int ( '010', 8) # 8 binary string into an integer
int 2 binary integer ( '10', 2) # string into

Guess you like

Origin blog.csdn.net/weixin_44266650/article/details/99719290