python two, eight, rapid conversion between hex

First, the binary conversion

1.2

Decimal Binary transfer bin (18) -> '0b10010' is removed 0b 10010 is the decimal binary switch 18 is 10010

Decimal turn octal oct (18) -> '022' is removed 22 0 18 rpm is the decimal octal 22

Decimal Hex turn hex (18) -> '0x12' shall be removed 0x 12 is decimal 18 octal 12 rpm

In turn words:

Binary Decimal int ( '0b10010', 2) -> 18

Octal turn decimal int ( '022', 8) -> 18

Decimal Hex turn int ( '0x12', 16) -> 18

Guess you like

Origin www.cnblogs.com/shiqi17/p/10926472.html