# -*-coding:utf-8-*- from functools import reduce def str2float(l): def get_digit(x): if str.isdigit(x): return int(x) def prod(x, y): return x*10+y n = len(l) - str.index(l, '.')-1 ol = list(map(get_digit, l)) ol.remove(None) return reduce(prod, ol)/(10**n)
Sign in to make a reply
流逝的仲夏夜之梦