I am trying to write an application to convert bytes to kb to mb to gb to tb. Here\'s what I have so far:
def size_format(b): if b < 1000: r
Rather than modifying your code, you can change the behaviour of division:
from __future__ import division
This provides "true" division over the "classic" style that Python 2.x uses. See PEP 238 - Changing the Division Operator for more details.
This is now the default behaviour in Python 3.x