Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. <div class=’General’>
  2. <div class=’First class’>
  3. <a href=’links what I need’></a>
  4. </div>
  5. </div>
  6.  
  7. import urllib.request
  8. from bs4 import BeautifulSoup
  9. html = urllib.request.urlopen('http://your/url')
  10. soup = BeautifulSoup(html, 'html.parser').find('div', class_='First-class')
  11. for i in soup.find_all('a'):
  12. print(i['href'])
  13.  
  14. links what I need
  15. links what I
  16. links what
  17. links
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement