thank you so much massimiliano for your hints.
e.g.
import locale
locale.setlocale(locale.LC_ALL, 'id_ID.utf8')
table.net.represent = lambda value, field: locale.format("%.3f", value,
grouping = True)
best regards,
stifan
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book
hi,
is it possible to change format double data type?
e.g.
default format : 1,000.00
expected format (that used in my country) : 1.000,00
i've tried :
represent = lambda net, field: format(net, ",.2f").replace(",", ".")
got the result : 1.000.00
how can i got the result as expected format
Try this way:
import locale
locale.setlocale(locale.LC_ALL, 'it_IT.UTF-8')
represent_currency = lambda value, row=None: ‘-' if not value else
locale.currency(value, symbol=True, grouping=True,
international=False).replace('Eu', '€')
change ‘it_IT.UTF-8' to your locale
On Wed, Oct 28, 2015
3 matches
Mail list logo