def str2num(ss): pos=ss.index('.') nn=ss.replace('.','') r=list(map(char2num,nn)) res=reduce(fn,r) wei={'1':10,'2':100,'3':1000} t=str(len(nn)-pos) res=res/wei[(t)] return res print('str2float') print(str2num('123.456'))
Sign in to make a reply
sofa_th