Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: latest version of python 
Python :: isodate in python 
Python :: binary tree in python 
Python :: python print same line 
Python :: django channel 
Python :: continue python 
Python :: comtypes python 
Python :: how to find uncommon records of two dataframes 
Python :: python __lt__ 
Python :: listas en python 
Python :: csv read python 
Python :: regularization pytorch 
Python :: how to hide tkinter window 
Python :: how to comment code in python 
Python :: matplotlib histogram frequency labels 
Python :: NLP text summarization with Luhn 
Python :: python find first occurrence in list 
Python :: How to filter with Regex in Django ORM 
Python :: simple seaborn heatmap 
Python :: pandas df.to_csv() accent in columns name 
Python :: python max 
Python :: is_isogram 
Python :: python ternary elif 
Python :: check if any letter in string python 
Python :: list to dataframe pyspark 
Python :: python max value in list 
Python :: lucky number codechef solution 
Python :: django background_task 
Python :: add row to dataframe with index 
Python :: python float range 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =