Discuss / Python / 第三题

第三题

Topic source
n=s.index('.')#找出小数点位置
s=s[:n]+s[n+1:]#去除小数点,因为pop无法在str使用
return reduce(lambda x,y:x*10+y,map(int,s))/(10**len(s[n:]))#先取整再除以10的次方让小数点归位

__吖糖

#2 Created at ... [Delete] [Delete and Lock User]

666


  • 1

Reply