DEV Community

Clavin June
Clavin June

Posted on • Originally published at clavinjune.dev on

Python Format Specifier for Thousands Separator

Photo by @volkanolmez on Unsplash

I hate to say this, but I forgot this one-liner syntax in my online coding test. So, I think I need to put this here.

format = lambda n: '{:,}'.format(n)
print(format(-1234567890)) # -1,234,567,890
Enter fullscreen mode Exit fullscreen mode

Top comments (0)