Python 3 offer very convinient way to control print function to print without new line or space. You just need … More How make print not to start new line with Python 3
Organize you values in a list: my_list=[‘first’, ‘second’, ‘third’, ‘first’, ‘forth’ ] Remove duplicates with one line: print(list(set(my_list))) N.B.! The … More How to get unique values with Python
Python glob module finds all the pathnames matching a specified pattern. import glob, os os.chdir(“/my_directory”) for file in glob.glob(“*.zip”): print(file) … More How to get list of files in directory with extension with Python
Datetime module provides means of checking if any date is valid. It covers leap years extra days, etc. If invalid … More How to check if date is valid with Python
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 is 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) ?