Python:ParseWeb

From wiki
Jump to navigation Jump to search

Check the beautifulsoup pages

from urllib.request import urlopen
import html5lib
from bs4 import BeautifulSoup

fh = urlopen(url)
soup = BeautifulSoup(fh.read(), 'html.parser')
result = soup.find_all(id = re.compile(pattern))[0].string