代码Python Beautifulsoup使用文本提取特定链接时出错
您好,我的代码有问题,我试图用此代码搜索一个特定的url,但它没有显示任何内容代码Python Beautifulsoup使用文本提取特定链接时出错,python,url,beautifulsoup,Python,Url,Beautifulsoup,您好,我的代码有问题,我试图用此代码搜索一个特定的url,但它没有显示任何内容 from BeautifulSoup import BeautifulSoup import urllib2 import re html_page = urllib2.urlopen(url) soup = BeautifulSoup(html_page) for link in soup.findAll('a', attrs={'href': re.compile("^http://www.fiuxy.net/
from BeautifulSoup import BeautifulSoup
import urllib2
import re
html_page = urllib2.urlopen(url)
soup = BeautifulSoup(html_page)
for link in soup.findAll('a', attrs={'href': re.compile("^http://www.fiuxy.net/misc.php")}):
print link.get('href')
我只想链接,它有“10”的文字,它改变每一次,(不是每次都一样)
我做了什么坏事
对不起,如果我的英语不好,因为我是西班牙语:(谢谢大家,但我自己用selenium解决了这个问题
from selenium import webdriver
driver.get(url)
puntos = driver.find_element_by_link_text(u"10")
print (puntos.get_attribute('href'))
soup.select('.dar puntos>a')[-1]。text
我在哪里添加的?@avinashrajfor循环替换为上述内容,不要忘记在之前添加打印。用于soup中的链接。select('.dar puntos>a')[-1]。text:print link
像这样吗?否,打印soup.select('.dar puntos>a')[-1]。text