def str2float(s):
# 这里只能这样用才能把list或者字符串变成键值对才能这样应用for循环 for n,p in enumerate(s): if p == ".": n1 = n print(n, p) def a(x, y): return x * 10 + y n2 = n1 + 1 num = len(s[n2:]) return reduce(a ,map(int, s[:n1])) + reduce(a, map(int, s[n2:])) / (10**num)
Sign in to make a reply
WALL_E91
def str2float(s):