To unzip a file with python, zipfile module needs to be imported: import zipfile a handler to zip file created: … More How to unzip file with Python
To find if variable exists one need to check both local and global scopes but running if ‘my_var’ in vars():… … More How to check if variable exists python
It is actually very simple. In order to find the name of current python script read form __file__ variable. For … More How to find the name of current python script running from command line
In order to check variable type, just use the following (mind replacing <var> with your variable name): if isinstance( <var>, … More How to check if variable if int (float, str…) in Python
There are several ways to get string length, i.e. size in symbols in Python. The most perfomance efficient is: my_var … More How to get the length (size) of a string in Python?
To make Coverage runing from PyBuilder to igrone any module: (for example run.py in Flask that shold not be tested) … More How to update coverage in pybuilder to igrore any module (i.e. run.py in flask) ?
Get parameters from a URL with Flask : Let’s assume that you are having the following URL: http://127.0.0.1/mypage?name=john&surname=smith Here is … More How to get parameters from a URL with Flask?
Get current working directory : import os result = os.getcwd() Get the directory of the script being run : import os … More How to get current directory in Python
Install Humanize: pip3 install humanize N.B.! If you are NOT running VirtualEnv, then you have to prepend the install command … More How to install Humanize module for Python 3
Get the time of last modification : import humanize result = humanize.naturalsize(intSizeValue, binary=True) More information: How to install Humanize module for Python3 … More How to get human readable file size