Discuss / Python / 一步一个角鹰又想了一个办法

一步一个角鹰又想了一个办法

Topic source
def str2float(s):
    b=s.split('.')
    blen=len(b[1])
    while blen>0:
        b[1]=float(b[1])
        b[1]=b[1]/10
        blen=blen-1
    return int(b[0])+b[1]
print(str2float('123.456'))

  • 1

Reply