Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
代码Python Beautifulsoup使用文本提取特定链接时出错_Python_Url_Beautifulsoup - Fatal编程技术网

代码Python Beautifulsoup使用文本提取特定链接时出错

代码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/

您好,我的代码有问题,我试图用此代码搜索一个特定的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/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