python_f_strings.txt        2025-05-08

https://docs.python.org/3/tutorial/inputoutput.html

Formatted string literals
https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings

Micropython differences
https://docs.micropython.org/en/latest/genrst/core_language.html

starts with f
acceps expressions between {}
formatting follws a :

{expr:10}       string left aligned   minimal 10 positions
{expr:10d}      decimal right aligned minimal 10 positions

a = '\u20ac35pietje'            # no utf-8 characters on LCD
f'{a!s}'                        # !s for str() and !r for repr()

Format Specification Mini-Language
https://docs.python.org/3/library/string.html#formatspec

f'{a:<16}'  f'{a:>16}'  f'{a:^16}'
