01- hexadecimal conversion

# A decimal turn the other band 
# 1, decimal, binary transfer 
Print (bin (10 ))
 # 2, octal, decimal turn 
Print (the OCT (10 ))
 # 3 decimal convert hexadecimal 
Print (hex (10 ))
 #
# Second, other binary decimal turn 
# 1, Binary decimal 
Print (int ( " 10010101 " , 2 ))
 # 2, octal, decimal turn 
Print (int ( " 667 " , 8 ))
 Print (6 * (8 ** 2) + 6 * (8 * 1) + 7 * (8 * 0))

# 3, from hexadecimal decimal 
Print (int ( " . 11A " , 16 ))
 Print (2 ** 16 + 16 + 10)

operation result

0b1010
0o12
0xa
149
439
439
282
282

 

Guess you like

Origin www.cnblogs.com/liangyf/p/11960128.html