# rupiah.py
# ---------------
import locale
def rupiah_format(angka, with_prefix=False, desimal=2):
locale.setlocale(locale.LC_NUMERIC, 'IND')
rupiah = locale.format("%.*f", (desimal, angka), True)
if with_prefix:
return "Rp. {}".format(rupiah)
return rupiah
>>> import rupiah
>>> rupiah.rupiah_format(10000)
'10.000,00'
>>> rupiah.rupiah_format(10000, True)
'Rp. 10.000,00'
thenx bang