9 lines
198 B
Python
9 lines
198 B
Python
|
|
||
|
def bytefmt(num):
|
||
|
for unit in [ "", "Ki", "Mi", "Gi" ]:
|
||
|
if num < 1024.0:
|
||
|
return "{:.2f}{}B".format(num, unit)
|
||
|
num /= 1024.0
|
||
|
return "{:05.2f%}{}GiB".format(num)
|
||
|
|