Skip to content
Advertisement

Scrape all href into list with BeautifulSoup

I’d like to to grab links from this page and put them in a list.

I have this code:

JavaScript

It produces following output:

JavaScript

I need to get following: [/en/catalog/view/514, ... , '/en/catalog/view/565']

But then I go ahead and add following: href_value = links.get('href') I got an error.

Advertisement

Answer

Try:

JavaScript

Output:

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