将
strip('%')用作:In [9]: "99.5%".strip('%')Out[9]: '99.5' #convert this to float using float() and divide by 100In [10]: def p2f(x): return float(x.strip('%'))/100 ....:In [12]: p2f("99%")Out[12]: 0.98999999999999999In [13]: p2f("99.5%")Out[13]: 0.995


