def str2float(s): def str2int(b): return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '.': '.'}[b] a = list(map(str2int, s)) b = len(a) - 1 - a.index('.') a.remove('.') return reduce(lambda x, y : x * 10 + y, a)/ 10.0 ** b
Sign in to make a reply
是不是该叫大飞叔了