I have an issue with formatting number output in Python. I found quite some examples how to do it with .format()
, but I can not figure it out how to set it up to my desired output.
I would like to have "." as thousand separator and "," as decimal (e.g. 7.654,32). If I want to do it vice-versa, I would use e.g. print("{0:,.2f}".format(7654.321))
, but I can not find the opposite. If nothing else, I could use replace()
, but would prefer an elegant solution, as I would use that further with Jinja2
in my html template.
Thank you and best regards,
Bostjan