mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 01:58:41 -05:00
Simplify the structure
This commit is contained in:
parent
117a1a36cc
commit
4e702d3f3a
13 changed files with 5 additions and 6 deletions
9
trimage/tools.py
Normal file
9
trimage/tools.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
def human_readable_size(num, suffix='B'):
|
||||
for unit in ['','K','M','G','T','P','E','Z']:
|
||||
if abs(num) < 1024.0:
|
||||
return "%3.1f%s%s" % (num, unit, suffix)
|
||||
num /= 1024.0
|
||||
return "%.1f%s%s" % (num, 'Y', suffix)
|
||||
Loading…
Add table
Add a link
Reference in a new issue