Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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}"
Comment

PREVIOUS NEXT
Code Example
Python :: run django app locally 
Python :: unlimited arguments python 
Python :: How to fix snap "pycharm-community" has "install-snap" change in progress 
Python :: python3 base64 encode basic authentication 
Python :: python random number 
Python :: python - give a name to index column 
Python :: find all nan columns pandas 
Python :: python barcode generator 
Python :: tqdm for jupyter notebook 
Python :: user agents list 
Python :: throw error python 
Python :: pandas set a column as index 
Python :: STandardScaler use example 
Python :: Could not find a version that satisfies the requirement psycopg2=2.8 (from pgcli) (from versions: 2.7.5, 2.7.6, 2.7.6.1, 2.7.7) 
Python :: SSL: CERTIFICATE_VERIFY_FAILED with Python3 
Python :: how to permanently store data in python 
Python :: how to create dynamic variable names in python 
Python :: find the closest position by time list python 
Python :: pandas remove row if missing value in column 
Python :: seaborn pairplot label rotation 
Python :: python heart code 
Python :: only keep few key value from dict 
Python :: filter list with python 
Python :: label encoding in pandas 
Python :: python os checj if path exsis 
Python :: how to open local html file in python 
Python :: python print code 
Python :: generate a list of random non repeated numbers python 
Python :: conda install nltk 
Python :: Change the user agent selenium 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =