I assumed getting the right path to get all the professors' "emails" on the website, but the output list is []
, meaning nothing in the path? Really dunno why :(
import requests
from lxml import etree
headers = {"User-Agent":""}
res = requests.get("https://www.csie.ntu.edu.tw/members/teacher.php?mclass1=110",headers=headers)
content = res.content.decode()
html = etree.HTML(content)
email = html.xpath('//li[@class="mail"]/a/text')
for e in email:
print(e)
Really appreciate your help. Thank the community so much.
source https://stackoverflow.com/questions/70454111/cannot-get-text-in-xpath-lxml-python
Comments
Post a Comment