Advertisement
Guest User

12312

a guest
Apr 23rd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. html = requests.get('https://www.naver.com/').text
  5. soup = BeautifulSoup(html, 'html.parser')
  6. #print(soup)
  7.  
  8. title_list = soup.select('.PM_CL_realtimeKeyword_rolling span[class*=ah_k]')
  9.  
  10. for idx, title in enumerate(title_list, 1):
  11. print("{}{} {}".format(idx, '위', title.text))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement