[web2py] Numbers Format

2011-11-07 Thread Franklin Freitas
In order to format numbers with thousands separator and custom number of decimals, I created the following function and included it in my "db.py" model so it could be accessed through the entire application. def number_format(num, places=0): return locale.format("%.*f", (places, num), True) I

Re: [web2py] Numbers Format

2011-11-07 Thread Vinicius Assef
Possibly the python version in your production server. str.format() is available since python 2.6. -- Vinicius Assef. On Mon, Nov 7, 2011 at 7:41 PM, Franklin Freitas wrote: > In order to format numbers with thousands separator and custom number > of decimals, I created the following function