I recently tried picking up web scraping on Python and wanted to experiment by grabbing the current temperature in whichever city the user inputs (as long as its in Ontario). The issue I am having is that the return value is empty, so when I check the value of my temperature variable by printing it, it doesnt print anything. The code is below:
import bs4
import requests
city = input("What city are you in? ")
URL = 'https://www.theweathernetwork.com/ca/weather/ontario/' + city.lower()
website = requests.get(URL)
soup = bs4.BeautifulSoup(website.text,"lxml")
temperature = soup.select(".temp")[0]
print(temperature.text)
Any help would be greatly appreciated, thanks!