convert variable to float python code example
Example 1: convert string to float python
string = "88.88"
print(float(string))
# output
# 88.88
Example 2: convert price to float python
from re import sub
from decimal import Decimal
money = '$6,150,593.22'
value = Decimal(sub(r'[^\d.]', '', money))