f syntax in python code example
Example 1: f string repr
>>> color = "blue\ngreen"
>>> day = datetime.date(2020, 6, 4)
>>> f"Color is {color} and day is {day}"
'Color is blue\ngreen and day is 2020-06-04'
>>> f"Color is {color!r} and day is {day!r}"
"Color is 'blue\\ngreen' and day is datetime.date(2020, 6, 4)"
Example 2: python f string
import math
print('[[fill]align] | f\'{"text":10}\' | ', f'{"text":10}')
print('[[fill]align] | f\'{"text":>10}\' | ', f'{"text":>10}')
print('[[fill]align] | f\'{"text":^10}\' | ', f'{"text":^10}')
print('[[fill]align] | f\'{"text":#>10}\' | ', f'{"text":#>10}')
print('[[fill]align] | f\'{"text":#<10}\' | ', f'{"text":#<10}')
print('[[fill]align] | f\'{"text":#^10}\' | ', f'{"text":#^10}')
print('[[fill]align] with numbers | f\'{12345:0=10}\' | ', f'{12345:0=10}')
print('[[fill]align] with numbers | f\'{-12345:0=10}\' | ', f'{-12345:0=10}')
print('[[fill]align] with numbers | f\'{12345:010}\' | ', f'{12345:010}')
print('[[fill]align] with numbers | f\'{-12345:010}\' | ', f'{-12345:010}')
print('[.precision] | f\'{math.pi:.2f}\' | ', f'{math.pi:.2f}')
print('[grouping_option] | f\'{1000000:,.2f}\' | ', f'{1000000:,.2f}')
print('[grouping_option] | f\'{1000000:_.2f}\' | ', f'{1000000:_.2f}')
print('[sign] (+/-) | f\'{12345:+}\' | ', f'{12345:+}')
print('[sign] (+/-) | f\'{-12345:+}\' | ', f'{-12345:+}')
print('[sign] (+/-) | f\'{12345:+10}\' | ', f'{12345:+10}')
print('[sign] (+/-) | f\'{-12345:+10}\' | ', f'{-12345:+10}')
print('[sign] (+/-) | f\'{12345:+010}\' | ', f'{12345:+010}')
print('[sign] (+/-) | f\'{-12345:+010}\' | ', f'{-12345:+010}')
print('[b] (binary) | f\'{10:b}\' | ', f'{10:b}')
print('[o] (octal) | f\'{10:o}\' | ', f'{10:o}')
print('[x] (hexadecimal) | f\'{100:x}\' | ', f'{100:x}')
print('[#b] (with notation base) | f\'{10:#b}\' | ', f'{10:#b}')
print('[#0] (with notation base) | f\'{10:#o}\' | ', f'{10:#o}')
print('[#x] (with notation base) | f\'{10:#x}\' | ', f'{10:#x}')
print('[e] (scientific notation) | f\'{345600000000:e}\' | ', f'{345600000000:e}')
print('[c] (character type) | f\'{65:c}\' | ', f'{65:c}')
print('percentage (multiply by 100) | f\'{0.25:0%}\' | ', f'{0.25:0%}')
print('percentage (multiply by 100) | f\'{0.25:.0%}\' | ', f'{0.25:.0%}')