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)
Sign in to make a reply
summer与生活
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)