Oct-26-2019, 09:53 PM
Can show a example of one way to do it.
from lxml import html import requests url_lst = ['https://www.cnn.com', 'https://python-forum.io'] for page in url_lst: page = requests.get(page) tree = html.fromstring(page.content) title = tree.xpath('//title') print('-' * 20) print(title[0].text)
Output:--------------------
CNN International - Breaking News, US News, World News and Video
--------------------
Python Forum