Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

beuatiful soup find a href

from BeautifulSoup import BeautifulSoup

html = '''<a href="some_url">next</a>
<span class="class"><a href="another_url">later</a></span>'''

soup = BeautifulSoup(html)

for a in soup.find_all('a', href=True):
    print "Found the URL:", a['href']
Comment

grab a href using beuatiful soup

from BeautifulSoup import BeautifulSoup

html = '''<a href="some_url">next</a>
<span class="class"><a href="another_url">later</a></span>'''

soup = BeautifulSoup(html)

for a in soup.find_all('a', href=True):
    print "Found the URL:", a['href']
Comment

PREVIOUS NEXT
Code Example
Python :: iris dataset python import 
Python :: redirect to previous page django 
Python :: how to stop python prompt 
Python :: get href scrapy xpath 
Python :: drop row based on NaN value of a column 
Python :: play music with time in python 
Python :: how to convert tuple to int in python 
Python :: python run as service windows 
Python :: python diamond 
Python :: how to delete nan values in python 
Python :: author nextcord interactions 
Python :: django static url 
Python :: python get username windows 
Python :: python random word 
Python :: scatter plot of a dataframe in python 
Python :: confusion matrix python code 
Python :: accessing dictionary elements in python 
Python :: key press python 
Python :: python print char n times 
Python :: python read zipfile 
Python :: remove columns that contain certain names in pandas 
Python :: selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable 
Python :: install nltk in python 
Python :: numpy apply function to array 
Python :: sending email in django 
Python :: python swap two elements 
Python :: python write list to file 
Python :: get count of unique values in column pandas 
Python :: simple trivia question python 
Python :: How to install XGBoost package in python 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =