Okay i need to turn a string to a float do some math then back to a string
def item_price(data): #grabs price of item
soup = BeautifulSoup(data)
info = soup.find('span', itemprop='price').text
info = info.replace("$","")
info = float(info); # but evary thing below this line goes wrong
info = info * .2 + info
info = "$" + string(info);
return(info);
While I don’t know anything about BeautifulSoap, but I think it’s the semicolons. Try this and see if it works:
Note: you had some other obvious syntax problems that I tried to clean up. Also, note that you should probably use decimal (over float) for money.
Link to Decimal docs