On 21Jun2018 10:12, Ethan Furman <et...@stoneleaf.us> wrote:
I need to translate numeric data in a string format into a binary
format. I know there are at least two different methods of
representing parts less that 1, such as "10.5" and "10,5". The data
is encoded using code pages, and can vary depending on the file being
read (so I can't rely on current locale settings).
I'm sure this is a solved problem, but I'm not finding those solutions. Any
pointers?
It sounds like you're conflating two problems:
- the file character data encoding
- the numeric representation
Can't you just read the file as a text file using the correct
codepage->decoding setting to get strings, _then_ parse numbers either with
some clunky regexp based approach or some flexible external library for common
numeric forms? (Someone suggested babel, I've never used it.)
Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list