Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # chunkSize.py
- def chunkSize(num):
- ''' human friendly file size '''
- for unit in [' bytes','k','m','g','t','p','e','z']:
- b=''
- if abs(num) < 1024:
- if len(unit) < 2: b='b'
- return "%3.1f%s%s" % (num, unit, b)
- num /= 1024.0
- return "%.1f%s" % (num, 'yb')
- #
- import random
- z=1
- while 1:
- sz=chunkSize(z)
- print z, 'bytes =', sz
- if 'yb' in sz: break
- z*=8
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement