how to scrape data from website code example
Example 1: how to scrape data from a html page saved locally
from bs4 import BeautifulSoup
import html5lib
myFile=open('C:/Users/CSE/AppData/Local/atom/app-1.42.0/practise.html','r')
soup=BeautifulSoup(myFile,"html5lib")
print(soup.prettify())
Example 2: web scraper python
>>> raw_html = simple_get('http://www.fabpedigree.com/james/mathmen.htm')
>>> html = BeautifulSoup(raw_html, 'html.parser')
>>> for i, li in enumerate(html.select('li')):
print(i, li.text)
0 Isaac Newton
Archimedes
Carl F. Gauss
Leonhard Euler
Bernhard Riemann
1 Archimedes
Carl F. Gauss
Leonhard Euler
Bernhard Riemann
2 Carl F. Gauss
Leonhard Euler
Bernhard Riemann
3 Leonhard Euler
Bernhard Riemann
4 Bernhard Riemann