Created
December 21, 2014 07:22
-
-
Save bmcculley/f3e94607090540a2c0e0 to your computer and use it in GitHub Desktop.
Python pretty print with thousands separators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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