Unit and date conversions, timers, user input conversions and much more Easy to understand coding.
humanfriendly.py
# -*- coding: utf-8 -*-
import humanfriendly
user_input = raw_input("Enter a readable file size: ")
#Enter 16KB
num_bytes = humanfriendly.parse_size(user_input)
print num_bytes
# Enter a readable file size: 16384
print "You entered:", humanfriendly.format_size(num_bytes)
# You entered: 16 KB
Recommended Posts