On 13 Aug 2008, rkmr wrote:
> is there any library /  function that prints number of bytes in human
> readable format?
> for example
>
> a=XX(1048576)
> print a
>
> should output
> 1 MB

http://mail.python.org/pipermail/python-list/1999-December/018519.html
is a good start - just need to change the table to something like::

    _abbrevs = [
                (2 ** 30L - 1, 'G'),
                (2 ** 20L - 1, 'M'),
                (2 ** 10L - 1, 'K'), 
                (1, '')
               ]

(and add a 'B').

-- 
-rob

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to