# -*- coding:utf-8 -*- from functools import reduce def normalize(name): return name[0].upper() + name[1:].lower() def prod(L): return reduce(lambda x, y: x*y, L) def char2num(s): return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}[s] def str2float(s): x = 0 l = s.split('.') x = reduce(lambda x, y: x * 10 + y, map(char2num, l[0])) x += reduce(lambda x, y: x * 10 + y, map(char2num, l[1]))*0.1**(len(l[1])) return x
Sign in to make a reply
默_kk