Python3.x:百分比数转小数

Python3.x:百分比数转小数

def change_percent(num):
    zfflag = ""
    if "+" in num:
        num = num.replace("", "")
    if "-" in num:
        zfflag = "-"
        num = num.replace("-", "")
    if "%" in num:
        num = num.replace("%", "")
    return zfflag+str(float(num) / float(100))

 

转载于:https://www.cnblogs.com/lizm166/p/8493985.html

你可能感兴趣的:(Python3.x:百分比数转小数)