def atof(string): # Python 2.x does not handle unicode number separators correctly, so we # have to implement our own global number_separators if number_separators is None: if iswindows: number_separators = get_windows_number_formats() else: lc = localeconv() t, d = lc['thousands_sep'], lc['decimal_point'] if isinstance(t, bytes): t = t.decode('utf-8', 'ignore') or ',' if isinstance(d, bytes): d = d.decode('utf-8', 'ignore') or '.' number_separators = t, d return float(string.replace(number_separators[1], '.').replace(number_separators[0], ''))
def atof(string): # Python 2.x does not handle unicode number separators correctly, so we # have to implement our own global number_separators if number_separators is None: if iswindows: number_separators = get_windows_number_formats() else: lc = localeconv() t, d = lc['thousands_sep'], lc['decimal_point'] if isinstance(t, bytes): t = t.decode('utf-8', 'ignore') or ',' if isinstance(d, bytes): d = d.decode('utf-8', 'ignore') or '.' number_separators = t, d return float(string.replace(number_separators[1], '.').replace(number_separators[0], ''))