Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a python project I am working on. How would I get rid of the hrefs for twitter? I am using python and beautiful
This is a python project I am working on. How would I get rid of the hrefs for twitter? I am using python and beautiful soup to scrape a website but I only want the links for the articles not a twitter link to show up in my array. import requests from bs4 import BeautifulSoup, SoupStrainer URL = 'https://www.usnpl.com/search/state?state=MI#section-D' page = requests.get(URL) soup = BeautifulSoup(page.content, 'html.parser') links = SoupStrainer('a') #Find a way to filter out facebook classes with i tag websites = soup.find_all(class_="w-10" ) a= [] for tag in websites: tdTags = tag.find_all("a") if tdTags: a.append(tdTags) for x in a: print(x)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started