I have created a new application called lopc (Lines of Python Code). It is available for install with pip on PyPI (https://pypi.org/project/lopc/), and the source code is available on GitHub: https://github.com/markkuleinio/lopc The app really only counts the number of non-empty and non-comment lines of *.py files in the given directories. These are some features of […]
Month: November 2022
Python f-String Formatting Codes
Here is my short list about the common f-string formatting codes in Python: >>> score = 123.728 >>> f”{score}” ‘123.728’ Minimum field length: >>> f”{score:>10}” ‘ 123.728’ >>> f”{score:<10}” ‘123.728 ‘ >>> f”{score:^10}” ‘ 123.728 ‘ Number of decimals: >>> f”{score:.2f}” ‘123.73’ >>> f”{score:10.2f}” ‘ 123.73’ >>> f”{score:<10.2f}” ‘123.73 ‘ Padded with a character: >>> […]