Question: Write a simple python program to crawl 10 pages from the web and store the text content in the pages into csv file. You code,
Write a simple python program to crawl 10 pages from the web and store the text content in the pages into csv file. You code, the 10 html pages, and the csv file which store the content in the pages should be submitted.
Tips: you can write your own program by referencing this tutorial: https://codeburst.io/scraper-b82146396249
Tips2:
(1) If you use python2 on your computer, you can use the following code to get web pages:
import urllib2
page = urllib2.urlopen('https://www.pythonforbeginners.com/')
print page.info() print page.read()
(2) If you use python3 on your computer, you can use the following code to get web pages:
import urllib.request page = urllib.request.urlopen('https://www.pythonforbeginners.com/')
print (page.info()) print (page.read())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
