humanize_bytes#

humanize_bytes(bytesize, decimals=3)[source]#

Convert a number of bytes into a human-readable total.

Parameters:
  • bytesize (int) – the number of bytes

  • decimals (int) – the number of decimal places to show

Example:

sc.humansize(2.3423887e6, decimals=2) # Returns '2.34 MB'

See the humansize library for more flexibility.

New in version 3.0.0.