Beautiful Soup
Learn how to take data that's displayed on websites and put it into Python using the Beautiful Soup library!
StartKey Concepts
Review core concepts you need to learn to master this subject
Beautiful Soup Object and Methods
Beautiful Soup Object and Methods
# This line of code creates a BeautifulSoup object from a webpage:
soup = BeautifulSoup(webpage.content, "html.parser")
# Within the `soup` object, tags can be called by name:
first_div = soup.div
# or by CSS selector:
all_elements_of_header_class = soup.select(".header")
# or by a call to `.find_all`:
all_p_elements = soup.find_all("p")
BeautifulSoup uses a parser to take in the content of a webpage. It provides tree traversal and advanced searching methods. It creates an object from the website contents.
Web Scraping with Beautiful Soup
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory