Difference between revisions of "Python:ParseWeb"

From wiki
Jump to navigation Jump to search
(Created page with "Check the [https://www.crummy.com/software/BeautifulSoup/bs4/doc/ beautifulsoup pages] <syntaxhighlight lang=python> from urllib.request import urlopen import html5lib from b...")
 
(No difference)

Latest revision as of 22:34, 14 July 2020

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