Discuss / Python / 第三题

第三题

Topic source

def str2float(str): index = 0 while str[index] != '.': index = index + 1; off = len(str) - index - 1 return reduce(lambda x, y:x *10+y, map(int, [s for s in str if s != '.']))/power(10, off)


  • 1

Reply