python beautifulsoup web scraping issue

Course Queries Syllabus Queries 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

page = requehttps://forum.tuteehub.com/tag/s">sthttps://forum.tuteehub.com/tag/s">s.get("http://www.freejobalert.com/uphttps://forum.tuteehub.com/tag/s">sc-recruitment/16960/#Engg-Servicehttps://forum.tuteehub.com/tag/s">s2019")
c = page.content
https://forum.tuteehub.com/tag/s">soup=BeautifulSoup(c,"html.parhttps://forum.tuteehub.com/tag/s">ser")
data=https://forum.tuteehub.com/tag/s">soup.find_all("tr")
for r in data:
    td = r.find_all("td",{"https://forum.tuteehub.com/tag/s">style":"text-align: center;"})
    for d in td:
        httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link =d.find_all("a")
        for li in httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link:
            https://forum.tuteehub.com/tag/s">span = li.find_all("https://forum.tuteehub.com/tag/s">span",{"https://forum.tuteehub.com/tag/s">style":"color: #008000;"})
            for https://forum.tuteehub.com/tag/s">s in https://forum.tuteehub.com/tag/s">span:
                https://forum.tuteehub.com/tag/s">strong = https://forum.tuteehub.com/tag/s">s.find_all("https://forum.tuteehub.com/tag/s">strong")
                for https://forum.tuteehub.com/tag/s">st in https://forum.tuteehub.com/tag/s">strong:
                        dict['title'] = https://forum.tuteehub.com/tag/s">st.text
        for l in httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link:
            dict["httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link"] = l['href']
    print(dict)

It ihttps://forum.tuteehub.com/tag/s">s giving

{'title': 'Syllabuhttps://forum.tuteehub.com/tag/s">s', 'httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link': 'http://www.uphttps://forum.tuteehub.com/tag/s">sc.gov.in/'}
{'title': 'Syllabuhttps://forum.tuteehub.com/tag/s">s', 'httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link': 'http://www.uphttps://forum.tuteehub.com/tag/s">sc.gov.in/'}
{'title': 'Syllabuhttps://forum.tuteehub.com/tag/s">s', 'httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link': 'http://www.uphttps://forum.tuteehub.com/tag/s">sc.gov.in/'}

I am expecting:

{'title': 'Apply Online', 'httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link': 'httphttps://forum.tuteehub.com/tag/s">s://uphttps://forum.tuteehub.com/tag/s">sconline.nic.in/mainmenu2.php'}
{'title': 'Notification', 'httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link': 'http://www.freejobalert.com/wp-content/uploadhttps://forum.tuteehub.com/tag/s">s/2018/09/Notification-UPSC-Engg-Servicehttps://forum.tuteehub.com/tag/s">s-Prelimhttps://forum.tuteehub.com/tag/s">s-Exam-2019.pdf'}
{'title': 'Official Webhttps://forum.tuteehub.com/tag/s">site ', 'httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link': 'http://www.uphttps://forum.tuteehub.com/tag/s">sc.gov.in/'}

Here i want all "Important Linkhttps://forum.tuteehub.com/tag/s">s" meanhttps://forum.tuteehub.com/tag/s">s "Apply online","Notification","official webhttps://forum.tuteehub.com/tag/s">site" and it'https://forum.tuteehub.com/tag/s">s httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">link for each table. but it ihttps://forum.tuteehub.com/tag/s">s giving me "Syllabuhttps://forum.tuteehub.com/tag/s">s" in title inhttps://forum.tuteehub.com/tag/s">stead with repeting httphttps://forum.tuteehub.com/tag/s">s://forum.tuteehub.com/tag/link">linkhttps://forum.tuteehub.com/tag/s">s..

pleahttps://forum.tuteehub.com/tag/s">se have a look into thihttps://forum.tuteehub.com/tag/s">s..

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.