Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python beautifulsoup get option tag value

# Import Module
from bs4 import BeautifulSoup
import requests

# Get HTML Content
r = requests.get("Enter Web URL:- ")

# Parse HTML Content
soup = BeautifulSoup(r.content, 'html.parser')

# Find select tag
select_tag = soup.find("select")

# find all option tag inside select tag
options = select_tag.find_all("option")

# Iterate through all option tags and get inside text
for option in options:
    print(option.text)
Source by www.techroadmap.in #
 
PREVIOUS NEXT
Tagged: #python #beautifulsoup #option #tag
ADD COMMENT
Topic
Name
3+9 =