Skip to main content

text/natsize.py

1#!/usr/bin/env python3
2"""
3Converts a number of bytes into a human-readable size.
5 $ echo '32036032' | natsize
6 32.0 MB
8"""
10import sys
12import humanize
15if __name__ == "__main__":
16 print(humanize.naturalsize(sys.stdin.read()))