0

I would like to format a decimal number, inluding numer of decimals and thousand separator respecting the user's locale. E.g

d = Decimal('1234567.1234')
print(locale.format(..., d, ...))

Should output:

1.234.567,123 # 3 decimals, '.' as thousand seprator
1,234,567.12  # 2 decimals, ',' as thousand seprator

And please do not just provide me with links to the docs. I have read those and still cannot figure it out. Thanks

schacki
  • 9,401
  • 5
  • 29
  • 32
  • 1
    Does this answer your question? [How to print number with commas as thousands separators?](https://stackoverflow.com/questions/1823058/how-to-print-number-with-commas-as-thousands-separators) – Jao Sep 17 '20 at 12:50
  • Well, I have read that one before and at least I am not able to find out how to define a local aware thousand operator and number of digits at the same time (unless doing manual string manipulation). – schacki Sep 17 '20 at 13:45

0 Answers0