Skip to content

Instantly share code, notes, and snippets.

@arxcruz
Created May 4, 2020 08:52
Show Gist options
  • Save arxcruz/26c67c0cb6be62d034f78156bcf89ae3 to your computer and use it in GitHub Desktop.
Save arxcruz/26c67c0cb6be62d034f78156bcf89ae3 to your computer and use it in GitHub Desktop.
Scrapping
from bs4 import BeautifulSoup
import requests
html_content = requests.get('https://www.who.int/news-room/q-a-detail/q-a-coronaviruses')
soup = BeautifulSoup(html_content.text, 'html.parser')
q_and_a = soup.find_all('div', class_='sf-accordion__panel')
for item in q_and_a:
question = item.find('a').text.strip()
answer = item.find('p').text.strip()
print('{},{}\n'.format(question, answer))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment