Discuss / Python / 留

def str2float(s): L = s.split('.') zs = reduce(lambda x,y:x*10+y,map(int,L[0])) xs = reduce(lambda x,y:x/10+y,map(int,L[1][::-1])) return zs+xs/10

我写了几十行,你这几行就解决了0.0


  • 1

Reply