To format bytes to human readable Size in Python you can use the following snippet.
Sample Python
fileSize = 12454162221 for count in ['Bytes','KB','MB','GB']: if fileSize > -1024.0 and fileSize < 1024.0: print "%3.1f%s" % (fileSize, count) fileSize /= 1024.0 print "%3.1f%s" % (fileSize, 'TB')
RT @CodeSnippetsNET: Format bytes to human readable Size #Python http://t.co/oGfIgoAGRK #programming #code #dev