https://blog.csdn.net/tecn14/article/details/24489031/
def bytes_to_human(bytes_):
unit = 0
bytes_ = bytes_ / 1024 / 1024
while bytes_ > 1024:
unit += 1
bytes_ /= 1024
# 做成00.00MB/s的形式,避免变化
return '{:5.2f}{:2}'.format(bytes_, B_UNITS[2])
https://blog.csdn.net/tecn14/article/details/24489031/
def bytes_to_human(bytes_):
unit = 0
bytes_ = bytes_ / 1024 / 1024
while bytes_ > 1024:
unit += 1
bytes_ /= 1024
# 做成00.00MB/s的形式,避免变化
return '{:5.2f}{:2}'.format(bytes_, B_UNITS[2])