Question: import requests, re, json from pprint import pprint from bs4 import BeautifulSoup def agatha_christie(website): Question 6 - Webscraping You will be webscraping the following
import requests, re, json from pprint import pprint from bs4 import BeautifulSoup
def agatha_christie(website): """ Question 6 - Webscraping
You will be webscraping the following Website to create a dictionary of Agatha Christie novels:
https://everythingagatha.com/home/every-agatha-christie-novel-in-order/
From this website you should create a list of lists of every Agatha Christie novel. The header row should contain three indicies: "Title", "Publication Year", and "Sleuth". Append the corresponding values for each novel to the list in order to create a list of lists
Cleaning: - There are a couple of titles that have a star (*) following them. You should remove this start and any spaces after the title before adding it to the dictionary - If a book has no value in the "Sleuth" column then the corresponding value in the dictionary should be None
Args: website (str) - url to a website Returns: list
>>> agatha_christie("https://everythingagatha.com/home/every-agatha-christie-novel-in-order/") [['Title', 'Publication Year', 'Sleuth'], ['The Mysterious Affair at Styles', '1920', 'Hercule Poirot'], ['The Secret Adversary', '1922', 'Tommy and Tuppence'], ['Murder on the Links', '1923', 'Hercule Poirot'], ['The Man in the Brown Suit', '1924', 'Anne Beddingfeld'], ['The Secret of Chimneys', '1925', 'Anthony Cade'], ['The Murder of Roger Ackroyd', '1925', 'Hercule Poirot'], ['The Big Four', '1927', 'Hercule Poirot'], ['The Mystery of the Blue Train', '1928', 'Hercule Poirot'], ['The Seven Dials Mystery', '1929', 'Chimneys Refs'], ['The Murder at the Vicarage', '1930', 'Miss Marple'], ['The Sittaford Mystery', '1931', 'Emily Trefusis'], ...
"""
pprint(agatha_christie("https://everythingagatha.com/home/every-agatha-christie-novel-in-order/"))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
