I've just practiced a code from youtube tutorial (https://www.youtube.com/watch?v=TJqbTDhF8Ng) and for a reason I can't understand the fucntion does't update the price variable, returns always the same figure. Nevertheless on the website the value changes very often and quickly. What's wrong with it?
import requests
import lxml
from bs4 import BeautifulSoup as bs
import time
url = "https://www.coindesk.com/price/bitcoin"
def bitcoin_scarper():
for n in range (1, 11):
result = requests.get(url)
soup = bs(result.content, "html.parser")
price = soup.find("div", {"class":"price-large"})
print(price.text)
time.sleep(10)
bitcoin_scarper()
Aucun commentaire:
Enregistrer un commentaire