map/reduce可以写出很简洁但是不好理解的代码
# -*- coding: utf-8 -*- from functools import reduce import math def str2float(s): return math.pow(10, -len(s.find('.'))) * reduce(lambda x, y: x * 10 + y, map(lambd z: o rd(z) - 48, s.replace('.', '')))
Sign in to make a reply
Yellow-Light
map/reduce可以写出很简洁但是不好理解的代码