I had this bit of code spitting out just the price as a string (125.01), but I must have changed something because now it prints the whole line with the html tags and everything
You have to call the get_text() method of your price
variable:
print(price.get_text())
You use get_text()
on your soup tag.
print(price.get_text())
Sometimes I've found that .text
or .get_text()
return an empty string and I have to use:
print(price.contents[0])
I think it has to do with unicode vs bytes being returned.