(Edit: Can't believe I am updating my answer in 2019 and again in 2020! This proves that the next phrase of human evolution is to share knowledge over the internet!)
With Python2.7+ or v3 you just use the "," option in your string formatting:
>>> "{:,}".format(100000000)
'100,000,000'
See PEP 378: Format Specifier for Thousands Separator for more info:
http://www.python.org/dev/peps/pep-0378/
With Python3.6+ you can also use the "_" format:
>>> "{:_}".format(100000000)
'100_000_000'
See PEP 515 for details:
https://www.python.org/dev/peps/pep-0515/
Added in 2014: These days I have the following shell function:
human_readable_numbers () {
python2.7 -c "print('{:,}').format($1)"
}
So I don't have to squint my eyes on big numbers.
Stop here unless you are unfortunate enough to be working with pre-2.7 code or environment without Python 2.7 when you read this...
You can also do that with locale:
import locale
locale.setlocale(locale.LC_ALL, 'en_US')
locale.format('%d', 2**32, grouping=True) # returns '4,294,967,296'
Hope this helps!