1.2 GB is easier to understand than 1234567890 Bytes, at least for humans. I write functions to ‘humanize’ numbers often, but it never seems worth keeping those functions around since they are generally quick and easy to write. Today I decided to finally stop rewriting the same thing over and over, and headed to PyPi –the Python module repository–, and of course there’s a module to do that on it:

>>> import humanize
>>> humanize.naturalsize(1234567890)
'1.2 GB'