Question
M6HW (Web Scraping) Introduction : The assignment involves using other libraries such as Beautiful Soup and requests libraries and tests students' knowledge on web scraping.
M6HW (Web Scraping)
Introduction:
The assignment involves using other libraries such as Beautiful Soup and requests libraries and tests students' knowledge on web scraping. It also requires the use of doctest library for testing functions.
IMPORTANT: Use Spyder (make sure it's Spyder 4 NOT 5) to complete this project (Spyder is one of the packages in Anaconda)
Instructions:
1. Create a Python code file named M6HW_WebScrapping_FirstLast.py (replace "FirstLast" with your own name) 2. Add a title comment block to the top of the new Python file using the following form
# A brief description of the project # Date # CSC221 M5HW - Web Scraping # Your Name
3. The file is to contain a main function and a function that generates/creates a text file that you will write the information you will extract from the webpage.
4. Choose a website of your choice to extract information from, you can also consider a website that lists historical events that happened on Today's date.
5. You are to extract a few paragraphs from this site. So you need to define the index position you will start extracting from and the index position you will stop extracting from. Make sure you have all this information referenced in variables. (50 points)
6. Create a function that will generate/create the text file you will write the information into.
- This function MUST have at least 2 test cases. Remember, test cases are to be added in the Docstring. If needed, refer to the video that explains how to do this for further guidance.
- The function is to do the following:
- Accept 3 arguments (the text representation of the BeautifulSoup object, the starting index position of the information you want to extract, and the ending index position of the information you want to extract. (10 points)
- Write information into a text file named historic.txt . (10 points)
- Information has to be properly written. For instance, add a newline after every full stop (.) (10 points)
- Remember, this function MUST have test cases added to its docstring.
7. Test the function using the Doctest library. Make sure no errors occur.
8. Take a screenshot of the results you get from the Doctest. Name the screenshot M5HW_Doctest_lastname (10 points)
Submit your finished code solution file(s) through the assignment link below
Grading criteria:
Shown next to each required point in the instructions above
Pseudocode and block comment (10 points )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started