MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / human_size

Function human_size

DemoPrograms/Demo_Desktop_Widget_RAM_Square.py:23–25  ·  view source on GitHub ↗

Returns a human readable string reprentation of bytes

(bytes, units=(' bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'))

Source from the content-addressed store, hash-verified

21
22
23def human_size(bytes, units=(' bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB')):
24 """ Returns a human readable string reprentation of bytes"""
25 return str(bytes) + ' ' + units[0] if bytes < 1024 else human_size(bytes >> 10, units[1:])
26
27
28sg.theme(THEME)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected