碱基之间复杂转化的实例

时间:2014-04-10 20:34:28

标签: python python-3.x binary base64

关于从各种基础转换的问题/

将0b11010111转换为十六进制&十进制(我知道你做16 ** 7 + 16 ** 6 + 16 ** 4 ......但b代表什么?)

将0xA6转换为二进制&十进制(混淆了B和如何转换)

1 个答案:

答案 0 :(得分:0)

以下是一些转化:

>>> bin(12)             # Binary is base 2 where switches are either on or off.
'0b1100'
>>> hex(0b1100)         # Hexadecimal is base 16, which is two to the fourth power.
'0xc'
>>> int(0b1100)         # Integer is of course base 10.
12
>>> int(0xa6)
166
>>> bin(0xa6)
'0b10100110'
>>>