我试图从这个XML URL http://www.rssmix.com/u/8287461/rss.xml中按标记名查找元素,如标题,但无法正常工作请帮助
只不过是打印一张空白页而已
browser.get("http://www.rssmix.com/u/8287461/rss.xml")
time.sleep(10)
title = browser.find_elements_by_tag_name('title')
description = browser.find_elements_by_tag_name('description')
link = browser.find_elements_by_tag_name('link')
for p_title, p_description, p_links in zip(title, description, link):
title_s = p_title.text
description_s = p_description.text
link_s = p_links.text
print (title_s + "\t" + description_s + "\t" + link_s + "\n")
根据您要从XML URL中提取标记的问题,您可以使用:
从Python的eem>xml.etree.ElementTree — The ElementTree XML API以及Selenium如下:
代码块:
控制台输出:
相关问题 更多 >
编程相关推荐