Skip to content

Instantly share code, notes, and snippets.

@bmcculley
Created December 21, 2014 07:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmcculley/f3e94607090540a2c0e0 to your computer and use it in GitHub Desktop.
Save bmcculley/f3e94607090540a2c0e0 to your computer and use it in GitHub Desktop.
Python pretty print with thousands separators
import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
def pp(num):
return locale.format("%d", num, grouping=True)
# test print
print pp(10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment