Python: format currency
May 15, 2010 19:53:27 Last update: May 15, 2010 19:54:37
Use the locale module.
>>> a = 1234.5678 >>> import locale >>> locale.setlocale(locale.LC_ALL, '') # set default locale 'English_United States.1252' >>> locale.currency(a) '$1234.57' >>> locale.currency(a, grouping=True) '$1,234.57' >>>
Easy email testing with http://www.ximailstop.com