我正在尝试删除此链接:https://www.axisbank.com/retail/cards/credit-card
使用以下代码
from urllib.request import urlopen
from bs4 import BeautifulSoup
import json, requests, re
axis_url = ["https://www.axisbank.com/retail/cards/credit-card"]
html = requests.get(axis_url[0])
soup = BeautifulSoup(html.content, 'lxml')
for d in soup.find_all('span'):
print(d.get_text())
输出:
close
5.15%
%
4.00%
%
5.40%
基本上,我想得到每一张卡片的详细信息
我尝试了不同的标签,但似乎没有一个有效
我很高兴看到代码满足我的要求
非常感谢您的帮助
会发生什么
你的主要问题是,网站动态地提供它的内容,而你不会得到你的目标,你所要求的wa。打印您的汤并查看,它将不包含您在浏览器中检查的元素
如何修复
使用selenium,它可以处理动态生成的内容,并提供您已经检查过的信息:
示例
相关问题 更多 >
编程相关推荐