daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Apr 21st, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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', href=True):
  12.     print(i['href'])
  13.    
  14. links what I need
  15. links what I
  16. links what
  17. links
RAW Paste Data
Top