Human readable number formatting

Erik Max Francis max at alcyone.com
Tue Sep 27 20:42:48 EDT 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:

BOTEC at

	http://www.alcyone.com/software/botec/

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

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
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