Created
January 22, 2019 03:30
-
-
Save allieus/c9b24924b6799a7e0d187de6507b76a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
res = requests.get("http://naver.com") | |
html = res.text | |
soup = BeautifulSoup(html, 'html.parser') | |
tag_list = soup.select('.PM_CL_realtimeKeyword_rolling .ah_k') | |
for rank, tag in enumerate(tag_list, 1): # 항상 하위 block 전에 콤마(:)를 씁니다. | |
label = tag.text | |
print('{}: {}'.format(rank, label)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment