+ 2

How to acces html link using python

I want to access html link through my code

18th May 2017, 2:04 PM
srinivasareddy yeruva
srinivasareddy yeruva - avatar
2 Respostas
+ 2
i don't dive deep enough into python, but i hope this can help you: Try withBeautifulsoup: from BeautifulSoup import BeautifulSoup import urllib2 import re html_page = urllib2.urlopen("http://www.yourwebsite.com")soup =BeautifulSoup(html_page) for link in soup.findAll('a'): print link.get('href') In case you just want links starting with http://, you should use: soup.findAll('a', attrs={'href': re.compile("^http://")})
18th May 2017, 2:47 PM
Setiawan Next
Setiawan Next - avatar
+ 1
Okie thanks for Info....will try it
18th May 2017, 2:50 PM
srinivasareddy yeruva
srinivasareddy yeruva - avatar