Question
I am doing my paper for C996 programming in python. I was able to write the code but I am not able to deduplicate the
I am doing my paper for C996 programming in python. I was able to write the code but I am not able to deduplicate the links and also export the links to the CSV file. below is my code. can you please advise me in what i need to add.
importrequests
frombs4importBeautifulSoup,SoupStrainer
importbs4,csv
search_link="https://www.census.gov/programs-surveys/popest.html"
r=requests.get(search_link)
raw_html=r.text
soup=BeautifulSoup(raw_html,"html.parser")
all_links=soup.find_all("a")
forlinkinsoup.find_all('a'):
print(link.get_text())
#print(all_links)']
withopen('links.csv','w',newline='')ascsvFile:
wr=csv.writer(csvFile,quoting=csv.QUOTE_ALL)
forlinkinsoup.find_all('a'):
wr.writerow(link)
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