I tried to get some strings from an HTML file with BeautifulSoup and everytime I work with it I get partial results.
I want to get the strings in every li element/tag. S
Iterate over results and get the value of text
attribute:
for element in soup.select(".sidebar li"):
print element.text
Example:
from bs4 import BeautifulSoup
data = """
- Def Leppard - Make Love Like A ManLive
- Inxs - Never Tear Us Apart
"""
soup = BeautifulSoup(data)
for element in soup.select('li'):
print element.text
prints:
Def Leppard - Make Love Like A ManLive
Inxs - Never Tear Us Apart