Answers for "python get file size human readable"

1

python get human readable file size

def human_readable_size(size, decimal_places=3):
    for unit in ['B','KiB','MiB','GiB','TiB']:
        if size < 1024.0:
            break
        size /= 1024.0
    return f"{size:.{decimal_places}f}{unit}"
Posted by: Guest on January-22-2020

Code answers related to "python get file size human readable"

Python Answers by Framework

Browse Popular Code Answers by Language