我想在一个网页上获取所有链接,这个功能只有一个链接,但需要获取所有链接!我当然知道需要一个戒指,但我不知道用途
我需要所有的链接
def get_next_target(page):
start_link = page.find('<a href=')
start_quote = page.find('"', start_link)
end_quote = page.find('"', start_quote + 1)
url = page[start_quote + 1:end_quote]
return url, end_quote
Tags:
您可以使用lxml进行此操作:
这就是HTML解析器派上用场的地方。我推荐^{} :
相关问题 更多 >
编程相关推荐