conversions.binary_to_octal

The function below will convert any binary string to the octal equivalent.

>>> bin_to_octal("1111")
'17'
>>> bin_to_octal("101010101010011")
'52523'
>>> bin_to_octal("")
Traceback (most recent call last):
    ...
ValueError: Empty string was passed to the function
>>> bin_to_octal("a-1")
Traceback (most recent call last):
    ...
ValueError: Non-binary value was passed to the function

Functions

bin_to_octal(→ str)

Module Contents

conversions.binary_to_octal.bin_to_octal(bin_string: str) str