我不熟悉网络垃圾,我正在刮一个网站-https://www.valueresearchonline.com/funds/22/uti-mastershare-fund-regular-plan/
但问题是,当我使用inspect元素时, 代码-
import requests
from bs4 import BeautifulSoup
import csv
import sys
url = 'https://www.valueresearchonline.com/funds/newsnapshot.asp?schemecode=22'
res = requests.get(url)
soup = BeautifulSoup(res.text, "html.parser")
regular_direct = soup.find('span',class_="filter-option pull-left").text
print(regular_direct)
我在打印中没有得到任何结果,我不知道为什么,inspect元素和view page source中的代码也不同,因为在view page source中,这个跨度和类不存在。 为什么我一个也得不到??有谁能告诉我,我怎样才能得到那个文本,为什么检查元素代码和查看页面源代码是不同的
您需要更改选择器,因为下载的html源不同
输出:
相关问题 更多 >
编程相关推荐