我正在尝试下载这个网站上的数据 https://coinmunity.co/ …以便以后在Python或Pandas中操作它 但我没有尝试直接使用代码:
res = requests.get("https://coinmunity.co/")
soup = BeautifulSoup(res.content, 'lxml')
table = soup.find_all('table')[0]
dfm = pd.read_html(str(table), header = 0)
dfm = dfm[0].dropna(axis=0, thresh=4)
dfm.head()
在我尝试的大多数事情中,我只能获取标题中的信息,这似乎是代码在本页中看到的唯一表。在
看到这不起作用,我试着用请求和BeautifulSoup做同样的处理,但也没用。这是我的代码:
^{pr2}$你可以从评论中看到,我所做的一切努力,但都没有奏效。 有没有什么方法可以轻松地下载该表,以便在Pandas/Python上使用它,以最整洁、最简单、最快的方式使用它? 谢谢你
由于内容是在发出初始请求后动态加载的,因此您将无法通过请求来获取此数据。我要做的是:
您需要确保安装了geckodriver,并且它在您的路径中。我只是粗略地记下了每枚硬币的名称和价值,但获取其余信息应该很容易。
相关问题 更多 >
编程相关推荐