• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 분석

  • 해결 여부

    미해결

숙제 질문 하겠습니다.

18.03.11 23:37 작성 조회수 105

0

이것저것 찾아보다 이렇게 나왔는데 수정할 부분이 있나요??

 from bs4 import BeautifulSoup  
 import urllib.request as req  
 import sys  
 import io

sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')  
 sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')

url = "[](https://www.daum.net/) [https://www.daum.net/](https://www.daum.net/)"  
 res = req.urlopen(url).read()  
 soup = BeautifulSoup(res,"html.parser")

top = soup.find_all("a", tabindex="-1")  
 for e in top:  
 print(e.string)  
 print(e.get('href'))  
 """  

답변 1

답변을 작성해보세요.

0

안녕하세요. 박경대님 답변이 늦었네요.
다음 실시간 검색어 관련 부분이네요.
해당 부분은 작성하는 사람에 따라서 방법이 여러가지라 결과값만 정확하게 출력된다면 문제될 건 없습니다.
tabindex 옵션을 활용하신 것도 좋습니다. ^^*
나중에 강의 종료 후에 해당 파트를 소스코드로 github에 올려드리도록 하겠습니다.
감사합니다.