File size: 388 Bytes
6e7844c
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import requests
from bs4 import BeautifulSoup

def parse(url):
    response = requests.get(url)
    if response.status_code == 200:
        # Parse the HTML content
        soup = BeautifulSoup(response.text, 'html.parser')
        question = soup.find('div', class_='html_text').find_all('p')
        answers = soup.find('div', id='answer1').find_all('p')
        return question,answers