社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

python硒靓汤不还网站html

Ellie The Good Dog • 7 年前 • 2556 次点击  

我只是想知道 https://investor.vanguard.com/529-plan/profile/4514 。我运行以下代码:

from selenium import webdriver
from bs4 import BeautifulSoup

driver = webdriver.Firefox(executable_path=r'C:\Program_Files_EllieTheGoodDog\Geckodriver\geckodriver.exe')
driver.get('https://investor.vanguard.com/529-plan/profile/4514')
html = driver.page_source
soup = BeautifulSoup(html, 'lxml')

当我“检查元素”selenium打开firefox的价格时,我清楚地看到:

<span data-ng-if="!data.isLayer" data-ng-bind-html="data.value" data-ng-class="{sceIsLayer : isETF, arrange : isMutualFund, arrangeSec : isETF}" class="ng-scope ng-binding arrange">$42.91</span >

但我不知道这些数据。如果我打印我的汤,html与网站上显示的非常不同。我试过,但完全失败了:

myspan = soup.find_all('span', attrs={'data-ng-if': '!data.isLayer', 'data-ng-bind-html': 'data.value', 'data-ng-class': '{sceIsLayer : isETF, arrange : isMutualFund, arrangeSec : isETF}', 'class': 'ng-scope ng-binding arrange'})

我完全被难住了。如果有人能给我指出正确的方向,我将非常感激。我觉得我完全失去了一些东西,可能有几件事…

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/44272
文章 [ 2 ]  |  最新文章 7 年前