Human readable number formatting

Erik Max Francis max at
Wed Sep 28 02:42:48 CEST 2005

Alex Willmer wrote:

> When reporting file sizes to the user, it's nice to print '16.1 MB',
> rather than '16123270 B'. This is the behaviour the command 'df -h'
> implements. There's no python function that I could find to perform this
> formatting , so I've taken a stab at it:


contains a class called SI which does this formatting (and supports all 
SI prefixes).

Erik Max Francis && max at &&
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Dead men have no victory.
   -- Euripides

More information about the Python-list mailing list