Created
May 24, 2020 10:34
-
-
Save saipraveenkondapalli/389cd6c74846902fd3da0622c50d2171 to your computer and use it in GitHub Desktop.
basic webscrapping for corona virus in india
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
from bs4 import BeautifulSoup | |
url = urllib.request.urlopen('https://www.mohfw.gov.in/') | |
soup = BeautifulSoup(url, 'html.parser') | |
cases = soup.findAll('li', class_= 'bg-blue') | |
active_cases = cases[0].strong.text | |
cured = soup.findAll('li', class_= 'bg-green') | |
discharged= cured[0].strong.text | |
deceased = soup.findAll('li', class_ = 'bg-red') | |
dead = deceased[0].strong.text | |
print(f"\n Active cases = {active_cases} \n Cured/Discharged ={discharged} \n Deaths ={dead}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment