+def make_bytes_readable(bytes):
+       if bytes>  10**12:
+               return "%.1f TiB" % (bytes / 10.0**12)
+       elif bytes>  10**9:
+               return "%.1f GiB" % (bytes / 10.0**9)
+       elif bytes>  10**6:
+               return "%.1f MiB" % (bytes / 10.0**6)
+       elif bytes>  10**3:
+               return "%.1f KiB" % (bytes / 10.0**3)
+
+       return None
+

argh, of course it's binary not decimal.
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to