看了评论才有了思路。。
Topic sourcedef str2float(s): L = s.split('.') L0 = L[0] L1 = L[1] digits = {'0':0,'1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} L0 = list(map(lambda x: digits[x],L0)) L1 = list(map(lambda x: digits[x], L1)) return reduce(lambda x,y: x*10 + y, L0) + reduce(lambda x, y : x*10 +y, L1) * 10 ** (-len(L1))
- 1
永恒是个旧念想