How to print a number using commas as thousands separators
In Python, you can use the built-in function format()
to print a number with commas as thousands separators. Here is an example:
This will output:
1,234,567
Watch a video course
Python - The Practical Guide
You can also use the f-string (f"")
This will also output:
1,234,567