I have a problem with turning a string into a float value. I'm screaming a website and trying to get the prices in to float values, but the problem is that the prices can look like this:
$2,549.98
$2,262.64
$999.00
marketprice = driver.find_element_by_xpath('/html/body/app/content-holder/marketplace-detail/landfield-detail/div/div/div[2]/div/div[1]/div[2]/span')
userprice = driver.find_element_by_xpath('/html/body/app/content-holder/marketplace-detail/landfield-detail/div/div/div[2]/div/div[1]/div[6]/span')
print(marketprice.text, userprice.text)
imarketprice = float(marketprice.text[1:])
iuserprice = float(userprice.text[1:])
When I try to convert the error I get:
ValueError: could not convert string to float: '2,549.98'
Is the problem with it that there are a comma and a dot?