Number Format function

2006-02-08 Thread Edward Hartfield
I'm am relatively new to Python but use it daily. Today, I went looking for a function, like PHP's number_function, that will take a number and return a string with number formatted with grouped thousands and the decimal portion rounded to a given number of places. This is certainly needed

Re: Number Format function

2006-02-08 Thread Edward Hartfield
Thanks. I noticed the bugs later. But after talking with my boss, he suggested something more elegant (again *untested*, yet): import locale def number_format(num, places=0) Format a number according to locality and given places locale.setlocale(locale.LC_ALL,