May-20-2020, 10:43 AM
(This post was last modified: May-20-2020, 10:43 AM by pyzyx3qwerty.)
(May-20-2020, 10:39 AM)drcodie Wrote: truncated is in div tags therefore the list of products is empty even if you change it from span. For price the following works:
def web_scrape ():
html = u.urlopen("https://www.amazon.com.au/gp/bestsellers/videogames/")
html_contents = html.read().decode()
htmlPrices = re.compile('sc-price[^\>]*\>(.*?)\<\/span\>')
prices = re.findall(htmlPrices, html_contents)
print(prices)
Don't forget the .*? or you will end up with everything!
If you like this then please like the findall video at https://youtu.be/YCSPhLOMPFM
Please use proper code tags while posting
And also preferably don't post answers; this is homework section
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs