Python - String format method with a thousand-separator syntax for numbers

Introduction

String format method with a thousand-separator syntax for numbers

It inserts commas between three-digit groups.

Demo

print( '{0:d}'.format(999999999999) )
print( '{0:,d}'.format(999999999999) )
print( '{:,d}'.format(999999999999) )
print( '{:,d} {:,d}'.format(9999999, 8888888) )
print( '{:,.2f}'.format(296999.2567) )

Result

Related Topic