bytesize._util.bases module

Utilities for base conversions.

bytesize._util.bases.convert_to(number, from_base, to_base)

Convert a number from from_base to to_base.

Parameters:
  • number (list of int (>= 0)) – the number to be converted
  • from_base (int) – the base of the number
  • to_base (int) – the base to convert to
Returns:

a converted number

Return type:

list of int

bytesize._util.bases.from_int(number, base)

Convert a number to a list of ints in a designated base.

Parameters:
  • number (int) – the number to be converted
  • base (int) – the designated base
Returns:

the number in the specified base

Return type:

list of int

bytesize._util.bases.to_int(number, base)

Convert number to an int.

Parameters:
  • number (list of int (>= 0)) – the number to be converted
  • base (int) – the base of the number
Returns:

the number as an int

Return type:

int

Previous topic

bytesize._util package

Next topic

bytesize._util.misc module

This Page