Apr-25-2018, 09:51 AM
It look like you try to put json data into BeautifulSoup.
What is the contented
For it to work it's has to be html.
What is the contented
html_data
?For it to work it's has to be html.
from bs4 import BeautifulSoup html_data = '''\ <!DOCTYPE html> <html> <head> <title>Title of document</title> </head> <body> <p>Content of the document</p> </body> </html''' soup = BeautifulSoup(html_data, 'lxml') print(soup.select('head > title')[0].text)
Output:Title of document