生成人类可读的字节数表示。
byteformat的Python项目详细描述
byteformat是一个python库和用于显示数字的命令行脚本 使用符合标准的可读单位(如 “23 KB”或“1.25 TB”。
Supports both official standards and the common de facto standard:
- SI decimal units, e.g. 1000 bytes = 1 KB;
- IEC binary units, e.g. 1024 bytes = 1 KiB;
- Mixed decimal names with binary sizes, e.g. 1024 bytes = 1 KB.
支持从kilo到yotta的全套十进制前缀- 二进制前缀kibi-到yobi-。
使用符号(例如“kb”)和缩写名称生成字符串 ('kbyte')或全名('kbyte')。
必要时使用正确的复数。
自动选择给定字节数的最佳单位。
允许调用方显式重写该选择并选择 使用哪个单位。
无需子类化即可轻松自定义输出。
作为python库模块导入。
作为命令行脚本运行。