Format file size for printing
John Zenger
john_zenger at yahoo.com
Sun Feb 19 22:49:09 EST 2006
I know of no built-in way, but you could probably code this in a few
lines using print "%.1f" and so on.
(Some of us, by the way, are in the camp that believes a kilobyte is
1024 bytes, not 1000, so 103803 bytes for us is about 101.4 kilobytes).
abcd wrote:
> is there a built-in way of printing the size of a file nicely?
>
> So if the file size is 103803 bytes it prints out like: 103.8K
> or
> 0.1MB
>
> something liek that?
>
More information about the Python-list
mailing list