Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Find All! | Beautiful Soup
Web Scraping with Python

bookFind All!

We can also use the function .find_all() to find not only one but multiple tags using a list. For instance:

1
print(soup.find_all(["title","h1"]))
copy

The code above returns the list of all title and h1 tags in our HTML file.

We can also use functions as an argument to find:

123
def find_all_condition(tag):     return tag.string == "City: New York" print(soup.find_all(find_all_condition))
copy

The code returns all tags which contain only the text "City: New York".

If you feel uncomfortable with functions in Python, repeat them with the course.

The BeautifulSoup library can optimize work and save a lot of time extracting the data from web pages. However, sometimes even such a magic tool can't detect the needed information. In such cases, parse the needed information with the function .find() and regular expressions!

question mark

Choose the correct syntax for find all div, h1, and title tags:

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 4

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Stel mij vragen over dit onderwerp

Vat dit hoofdstuk samen

Toon voorbeelden uit de praktijk

Awesome!

Completion rate improved to 4.76

bookFind All!

Veeg om het menu te tonen

We can also use the function .find_all() to find not only one but multiple tags using a list. For instance:

1
print(soup.find_all(["title","h1"]))
copy

The code above returns the list of all title and h1 tags in our HTML file.

We can also use functions as an argument to find:

123
def find_all_condition(tag):     return tag.string == "City: New York" print(soup.find_all(find_all_condition))
copy

The code returns all tags which contain only the text "City: New York".

If you feel uncomfortable with functions in Python, repeat them with the course.

The BeautifulSoup library can optimize work and save a lot of time extracting the data from web pages. However, sometimes even such a magic tool can't detect the needed information. In such cases, parse the needed information with the function .find() and regular expressions!

question mark

Choose the correct syntax for find all div, h1, and title tags:

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 4
some-alt