>>> num = 10000000
>>> print(f"{num:,}")
10,000,000
'{:,}'.format(value) # For Python ≥2.7
f'{value:,}' # For Python ≥3.6
amount = 1000000
text = 'The amount he paid us was ${:,}'
print(text.format(amount))
#>>>The amount he paid us was $1,000,000
import locale
locale.setlocale(locale.LC_ALL, '') # Use '' for auto, or force e.g. to 'en_US.UTF-8'
'{:n}'.format(value) # For Python ≥2.7
f'{value:n}' # For Python ≥3.6