I know the question may seem very basic but I can't seem to extract the li and the text from the given uls.
https://solar.world.org/reuse/Aluminum.Foil
Here is the url I am trying to extract. I have tried using find_all for ul but that gives me a weird return result and I can't use it to extract any text from the li.
In theory this code should work.
page = requests.get('https://solar.world.org/reuse/Aluminum.Foil')
soup = BSoup(page.content, 'html.parser')
for i in soup.find_all('ul'):
for j in i.find_all('li'):
print(j.text)
but its not.
CodePudding user response:
The page has very bad formatting (not your fault). Use a better parser to parse it:
soup = BSoup(page.content, 'html5')