def str2float(s): a, b = s.split('.') zs = reduce(lambda x, y: x * 10 + y, map(convert, a)) xs = reduce(lambda x, y: x*0.1+y, map(convert, reversed(b))) return zs + xs*0.1 def convert(ite): dic = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6} return dic[ite]
Sign in to make a reply
新雨沐晨风