convert decimal mark
I have a CSV file with data reading that I want to read into Python. I get lists that contain strings like "2,5" . Now doing float("2,5") does not work, because it has the wrong decimal mark. How do I read this into Python as 2.5 ? eumiro float("2,5".replace(',', '.')) will do in most cases If value is a large number and . has been used for thousands, you can: Replace all commas for points: value.replace(",", ".") Remove all but the last point: value.replace(".", "", value.count(".") -1) You may do it the locale-aware way: import locale # Set to users preferred locale: locale.setlocale(locale