convertendo binário em octal em python
biNum = '1010'
print(oct(int(biNum, 2))[2:])
BreadCode
biNum = '1010'
print(oct(int(biNum, 2))[2:])
==== 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 <class 'int'>
octalNum = oct(decimalNum)[2:] # base 10 to base 8
print(octalNum, type(octalNum)) # 314 <class 'str'>