adsterra

Scrape Corona Updates using Python Programming |Source code|

Get the Corona Virus updates using Python Programming



Firstly You need to install bs4 module of python then write the below code:

import requests                                                                      
from bs4 import BeautifulSoup                                          
url="https://www.worldometers.info/coronavirus/"      
r=requests.get(url)                                                                 
s= BeautifulSoup(r.text,"html.parser")                              
data = s.find_all("div",class_="maincounter-number")  
print("Total Cases: ",data[0].text.strip())                           
print("Total Deaths: ",data[1].text.strip())                         
print("Total Recovered: ",data[2].text.strip())                   




Output:


Post a Comment

0 Comments