Question: Exploring the module: (Turn in a Python file for this section) Remember how we used urllib to scrape content from a website? import urllib.request web_page

Exploring the module: (Turn in a Python file for this section)

Remember how we used urllib to scrape content from a website?

import urllib.request

web_page = urllib.request.urlopen()

contents = web_page.read().decode(errors="replace")

web_page.close()

Wouldnt that be cool to scrape a webpage then immediately use BeautifulSoup to find just the pieces we need? Yeah, it would be. Unfortunately, repl.it free accounts dont allow web scraping, so weve saved the HTML from the pages used in the CHALLENGES below for you. Upload these files by clicking the cloud with the arrow on it pointing up. (If for some reason this doesnt work, make the files yourself -- view the source at each URL, copy the HTML code, and put it into a new file within repl.it.)

First, open the file and read in the contents:

Example:

file = open('fbi.html', 'r')

html = file.read()

file.close()

Then perform some BeautifulSoup filtering and selection. There is likely more than one way to do all of these challenges. Your output should look like ours when done.

This is Problem what we need to solve : ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1. Print all U.S. multi-state foodborne outbreak investigations for 2016 and 2017. Use file outbreaks.html.

Hint: find_all() returns a list with the results. You cant call a second find_all() on a list, but you might be able to do so on the items within the list. Reference URL: https://www.cdc.gov/foodsafety/outbreaks/multistate-outbreaks/outbreaks-list.html

Exploring the module: (Turn in a Python file for this section) Remember

Vulto Creamery Soft Raw Milk Cheese 1.M. Healthy SoyNut Butter Shell Eggs Beef Products Frozen Strawberries Frozen Scallops Alfalfa Sprouts Flour Frozen Vegetables Raw Milk Pistachios Alfalfa Sprouts Alfalfa Sprouts Organic Shake & Meal Products Packaged Salads Vulto Creamery Soft Raw Milk Cheese 1.M. Healthy SoyNut Butter Shell Eggs Beef Products Frozen Strawberries Frozen Scallops Alfalfa Sprouts Flour Frozen Vegetables Raw Milk Pistachios Alfalfa Sprouts Alfalfa Sprouts Organic Shake & Meal Products Packaged Salads

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!