def normalize(name): name = name[0].upper() + name[1:].lower() return name from functools import reduce def prod(L): def f(x,y): return x*y return reduce(f,L) from functools import reduce def str2float(s): DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} i = s.index('.') a = reduce(lambda x, y: x * 10 + y, map(lambda x: DIGITS[x], s[0:i])) b = reduce(lambda x, y: x * 10 + y, map(lambda x: DIGITS[x], s[i + 1:]))/(10**len(s[i + 1:])) return a+b
Sign in to make a reply
打不死的小怪兽zj