Python Forum
mixed decimal point characters - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: mixed decimal point characters (/thread-16677.html)



mixed decimal point characters - Skaperen - Mar-10-2019

i have some data in a timed mix to be processed by a Python program i wrote. some of the data uses the European standard of ',' for the decimal point character. mass conversion of all ',' to '.' messed up a lot of ',' in other parts of the data. i am wondering if Python has any facilities for handling a mix of data like that. or else i'll have to write some of my own.

in a different case i may need to process some numbers like 1,234,768 and such (hopefully just US standard).


RE: mixed decimal point characters - stullis - Mar-10-2019

A quick look suggests there isn't anything of the sort in the standard library. There could be something in PyPi or on Github. Perhaps inherit from Decimal and add parsing and formatting methods to accommodate the format difference.