thousands separator python

>>> num = 10000000
>>> print(f"{num:,}")

Here is what the above code is Doing:
1. We’re using the f-string syntax to create a string that contains the value of num.
2. We’re using the comma as a thousands separator.
3. We’re using the colon to specify the alignment of the string.
4. We’re using the right alignment to align the string to the right.

The output of the code is:


As you can see, the comma is used as a thousands separator and the string is aligned to the right.