Skip to content
Advertisement

Python Web Scrape Query DIV data-brand

I’m trying to grab a div tag in an html page, but the result is showing an empty list. I’ve provided the code and a picture of the html. The page_text variable is an empty list.

JavaScript

html code

Advertisement

Answer

You are close to your goal, just add True as value in your dict:

JavaScript

As alternative you can go with css selectors and list comprehension to get all the values:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement