Python Forum
Read input file and print hyperlinks
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read input file and print hyperlinks
#9
You most learn to not use quote tag on code,
i have fixed all you post.
In editor there there is "Insert python tag" to right of "Insert quote" button.

This is wrong:
print(link.get_text())
# Shall be
print(link.text)
Quote:but I still get links that I do not wont, like the links from img tags, is there any way to exclude them from print?
for link in soup.find_all('a'):
    if 'img' not in link:
        print(link.get('href'))
        print(link.text)
Reply


Messages In This Thread
Read input file and print hyperlinks - by Emmanouil - Oct-22-2016, 11:07 AM
RE: Read input file and print hyperlinks - by snippsat - Oct-23-2016, 07:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask read real time print from subprocess without deadlock vofka32 0 4,166 Jun-02-2021, 09:36 AM
Last Post: vofka32
  Open and read a tab delimited file from html using python cgi luffy 2 2,757 Aug-24-2020, 06:25 AM
Last Post: luffy
  Read owl file using python flask Gayathri 1 2,518 Nov-20-2019, 12:56 PM
Last Post: ChislaineWijdeven
  Read XML-File yuyu 16 7,367 Dec-15-2018, 10:49 PM
Last Post: snippsat
  how to read data from xml file Raj 7 5,402 Apr-14-2018, 12:14 PM
Last Post: Raj
  How to get hyperlinks in to the table extracted by BeautifulSoup KenniT 2 5,032 Apr-04-2018, 10:05 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020