I'm trying to extract the HTML code of a table from a webpage using BeautifulSoup.
<table class="facts_label" id="facts_table">...</table>
I would like to know why the code bellow works with the "html.parser"
and prints back none
if I change "html.parser"
for "lxml"
.
#! /usr/bin/python
from bs4 import BeautifulSoup
from urllib import urlopen
webpage = urlopen('http://www.thewebpage.com')
soup=BeautifulSoup(webpage, "html.parser")
table = soup.find('table', {'class' : 'facts_label'})
print table
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…