I'm trying to get the <li>
's of an html using python's library BeautifulSoup.
The HTML im trying to parse is this one:
https://ccnav6.com/ccna-4-chapter-1-exam-answers-2017-v5-0-3-v6-0-full-100.html
It contains a list of questions and answers and I'm trying to parse those.
My Problem is, that no matter how I go about to parse the html, I only get the first <li>
.
My Code:
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
url = 'https://ccnav6.com/ccna-4-chapter-1-exam-answers-2017-v5-0-3-v6-0-full-100.html'
uClient = uReq(url)
# getting html from connection
page_html = uClient.read()
# close connection
uClient.close()
# use beautifulSoup to parse html
page_soup = soup(page_html, "html.parser")
# get main content of page
contentBlock = page_soup.find("div",{"class":"post-single-content box mark-links entry-content"})
# get all questions and answers
questions = questions = contentBlock.div.ol.li.ol.findAll("li")
# for some reason i'm only getting the first question