Voici la procédure:

def sizeof_fmt(num):
	for x in ['bytes','KB','MB','GB','TB']:
		if num < 1024.0:
			return "%3.1f%s" % (num, x)
		num /= 1024.0

Exemple:

>>> sizeof_fmt(168963795964)
'157.4GB'

Trop facile! :laClasse: