[Edit]
+
0
-
0

python convert percentage value into decimal number

1105
1 2 3 4 5 6 7 8 9 10
def percent_to_decimal(percent): return float(percent[:-1]) / 100.0 # Usage example: print(percent_to_decimal('10%')) # 0.1 print(percent_to_decimal('20%')) # 0.2 print(percent_to_decimal('50%')) # 0.5 print(percent_to_decimal('100%')) # 1.0