python - 如何使用beautifulsoup从div下面提取id数据值?
问题描述
请帮我。我已经尝试了很多事情,但我无法做到这一点。
<div class="dfx-singleInstrument__price dfx-rate dfx-font-size-3 font-weight-bold text-right" data-stream-type="price" data-symbol="EURUSD" data-market-id="EURUSD" data-type="bid" data-change-scale="-1" data-unscaling-factor="10000" data-unscaled-decimals="5" data-value="1.18610">
</div>
解决方案
采用:
soup.select_one('.singleInstrument__price')['data-value']
推荐阅读
- python - 我的代码在超过 15500 次迭代时突然停止编写
- amazon-web-services - 如何将 AWS EC2 负载均衡器添加到与我的静态前端相同的域
- julia - 具有邻接矩阵的 Dijkstra 算法
- php - 我想复制 $friendname=$_POST['friendname']; 当 if 语句有效并在此处回显时,值到下一页
- xamarin - 在 Xamarin Forms 中使用邮件服务时,我们如何获取 SmtpServer NetworkCredentials?
- ruby - 无法安装 vagrant-hostsupdater
- reactjs - 在 cPanel 上部署 React 应用程序后,Web 目录可见
- python - .replace() 不替换元素
- javascript - WebRTC onicecandidate 永远不会在 chrome 中触发
- ios - 单击另一个按钮 swift 2.2 更改声音按钮图像