
Have a Python number, and want commas before every 3 digits? Use , in an f-string:
x = 1234567890
print(f'{x:,}') # 1,234,567,890
Floats, too:
x = 987654321.4567890
print(f'{x:,}') # 987,654,321.456789
Combine , and .2f:
print(f'{x:,.2f}') # 987,654,321.46
