I am working on a forecasting project and in this project, we need country population data for forecast something , I want to take a real time population number from a website I tried this code but it returning "retriving data...." and i'm totally confused
import bs4
import requests
from bs4 import BeautifulSoup
def population():
r=requests.get('https://www.worldometers.info/world-population/india-population/')
soup=bs4.BeautifulSoup(r.text,'html')
population=soup.find('div',{'class':'maincounter-number'}).find('span').text
return population
while True:
print('the current population:' +str(population()))