内置函数:进制转换,bin,oct,hex

bin:将整型转换成二进制,以0b显示

oct:将整型转换成八进制,以0c显示

hex:将整型转换成十六进制,以0x显示

print(bin(15155))
print(oct(15155))
print(hex(15155))

#打印:
0b11101100110011
0o35463
0x3b33

猜你喜欢

转载自www.cnblogs.com/aizhinong/p/11405327.html