Discuss / Python / 第三题

第三题

Topic source

FranZhou

#1 Created at ... [Delete] [Delete and Lock User]
def str2float(s):
    n = s.find('.')
    return reduce(lambda x, y: x + y, 
                  [
                      reduce(lambda x, y: x * 10 + y, map(lambda x: int(x), iter(s[:n]))), 
                      reduce(lambda x, y: x * 10 + y, map(lambda x: int(x), iter(s[n + 1:]))) * 10 ** (n - (len(s) - 1)) 
                  ])

iq052

#2 Created at ... [Delete] [Delete and Lock User]

您这个好高级


  • 1

Reply