diff --git a/kicost/distributors/api_mouser.py b/kicost/distributors/api_mouser.py index ec116f0a..4d2b81af 100644 --- a/kicost/distributors/api_mouser.py +++ b/kicost/distributors/api_mouser.py @@ -64,6 +64,9 @@ def get_number(string): if index is None: raise MouserError('Malformed price: ' + string) string = string.replace(',', '.') + dot_count = string.count('.') + if dot_count > 1: + string = string.replace('.', '', dot_count - 1) end = next((i for i, d in enumerate(string[index:], start=index) if not (d.isdigit() or d == '.')), None) if end is not None: return float(string[index:end])