📅  最后修改于: 2022-03-11 14:46:46.456000             🧑  作者: Mango
==== Convert binary to octal in Python =====
binaryNum = '11001100' # input a binary
decimalNum = int(binaryNum, 2) # base 2 to base 10
print(decimalNum, type(decimalNum)) # 204
octalNum = oct(decimalNum)[2:] # base 10 to base 8
print(octalNum, type(octalNum)) # 314