from functools import reduce
def str2float(s):
digits = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4,
'5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
power = 0
if '.' in s:
power = len(s) - s.index('.') - 1
integers = [digits[x] for x in s if x is not '.']
return reduce(lambda x, y: x * 10 + y, integers) * 10**(- power)
print(str2float('584'))
fomiuna
一、
二、
三、