Reputation: 862
I'm using locale.setlocale(locale.LC_ALL, 'fr_FR')
. The thousands separator in French is a space -- when checking using locale.localeconv()['mon_thousands_sep']
, the output is \xa0
, which apparently stands for non-breaking space.
The problem arises when I start reading in French csv files: The numbers are indeed formatted using a space as a separator, i.e. 30 500,75
(For thirty thousand and five hundred and three quarters).
But trying to read that in using locale.atof
breaks: It says it can't read that number in. I assume this is due to multiple space characters existing, but I can't exactly tell my users to make sure their space characters are exactly the one locale needs. Is there a way to get locale to be more flexible on what it considers a space?
Upvotes: 0
Views: 36