我试图提取下表中的所有行业和时期的网站。然而,当我下载html时,在网站上显示的数字在任何地方都找不到。如何检索表的条目?你知道吗
https://csimarket.com/Industry/industry_Efficiency.php?ind=102
下面的代码提取了html。经过检查,表中的数字没有出现在任何地方,所以我无法提取它们。问题是他们在哪里?如何访问和提取它们?你知道吗
请注意,我是新来的要求和美丽的汤! 非常感谢!你知道吗
import requests
my_target='https://csimarket.com/Industry/industry_Efficiency.php?ind=102'
r = requests.get(my_target)
data = r.text
使用熊猫会更整洁
read_html
您可以使用
requests
,但您需要使用r.content
而不是r.text
:您也可以使用^{} module 来解析
html
,如下所示:这给了你:
您可以使用urllib包,然后使用正则表达式提取数字。执行:
这将提供:
相关问题 更多 >
编程相关推荐