Number Format function

wittempj@hotmail.com martin.witte at gmail.com
Wed Feb 8 16:16:09 EST 2006


This is a little faster:

def number_format(num, places=0):
    """Format a number according to locality and given places"""
    locale.setlocale(locale.LC_ALL, "")
    return locale.format("%.*f", (places, num), True)

I tested this ok with my test




More information about the Python-list mailing list