"abcd" <codecraig at gmail.com> writes: > 1890284 > > would be: > > 1,890,284 "To iterate is human; to recurse, divine": def commafy(n): if n < 0: return '-' + commafy(-n) if n >= 1000: return '%s,%03d' % (commafy(n//1000), n % 1000) return '%s'% n I don't like the locale solution because of how messy locales are.