【发布时间】:2021-06-29 19:41:12
【问题描述】:
我正在制作一个加密货币手表应用程序。我使用这个请求,但我总是接受相同的请求。
coin_list = ["bitcoin", "ethereum", "bittorrent", "xrp", "dogecoin"]
while(True):
for coin in coin_list:
print(BeautifulSoup.get_text(BeautifulSoup(requests.get('https://www.coindesk.com/price/'+coin).content, 'html.parser').find('div', {'class': 'price-large'}))[1:])
这个脚本返回给我:
36,331.66
2,219.07
0.002826
0.716486
0.266623
36,331.66
2,219.07
0.002826
0.716486
0.266623
36,331.66
2,219.07
0.002826
0.716486
0.266623
36,331.66
2,219.07
0.002826
0.716486
0.266623
36,331.66
2,219.07
0.002826
0.716486
0.266623
36,331.66
2,219.07
0.002826
这与缓存无关。我尝试使用标题。
【问题讨论】:
-
那么,程序到底出了什么问题?对于列表中的每个硬币,您都会得到不同的响应。
-
我对每枚硬币都有不同的反应,但每枚硬币本身都返回相同的值
标签: python python-3.x beautifulsoup python-requests