number_format() in python

php’s number_format() in python.

1
2
3
4
5
import locale
locale.setlocale(locale.LC\_NUMERIC,'ja\_JP.UTF-8')

#locale.setlocale(locale.LC\_ALL, "")    #NG
return locale.format("%d",int\_p,1)

まさかロケール使う羽目になるとは。