I'm trying to format a float as comma-separated currency. E.g. 543921.9354
becomes $543,921.94
. I'm using the format
filter in Jinja templates, which seems to mimic the %
operator in Python rather than the Python format
function?
How can I accomplish this formatting in Jinja? Is it possible using the format
filter? This is what I have so far, which accomplishes everything except the commas:
"$%.2f"|format(543921.9354)
which of course yields
$543921.94