반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 머신러닝
- bccard
- 결합전문기관
- cudnn
- web 사진
- Keras
- inorder
- web 용어
- postorder
- CES 2O21 참가
- CES 2O21 참여
- 대이터
- broscoding
- paragraph
- web
- tensorflow
- vscode
- web 개발
- mglearn
- 자료구조
- C언어
- java역사
- html
- discrete_scatter
- 재귀함수
- 데이터전문기관
- 웹 용어
- pycharm
- KNeighborsClassifier
- classification
Archives
- Today
- Total
bro's coding
python.webcrawling.beautiful soap.find/find_all 본문
반응형
import requests
from bs4 import BeautifulSoup
response = requests.get("http://naver.com")
data = BeautifulSoup(response.text,"html.parser")
# id가 u_skip인 것들을 모두 찾음
print(data.find(id="u_skip"))
'''
<div id="u_skip"> <a href="#newsstand"><span>뉴스스탠드 바로가기</span></a> <a href="#themecast"><span>주제별캐스트 바로가기</span></a> <a href="#timesquare"><span>타임스퀘어 바로가기</span></a> <a href="#shopcast"><span>쇼핑캐스트 바로가기</span></a> <a href="#account"><span>로그인 바로가기</span></a> </div>
'''
import requests
from bs4 import BeautifulSoup
response = requests.get("http://naver.com")
data = BeautifulSoup(response.text,"html.parser")
# 속성
attr = {"id":"u_skip"}
# div tag를 가진 것들 중 id가 u_skip인 것들을 모두 찾음
print(data.find_all("div",attrs=attr))
'''
[<div id="u_skip"> <a href="#newsstand"><span>뉴스스탠드 바로가기</span></a> <a href="#themecast"><span>주제별캐스트 바로가기</span></a> <a href="#timesquare"><span>타임스퀘어 바로가기</span></a> <a href="#shopcast"><span>쇼핑캐스트 바로가기</span></a> <a href="#account"><span>로그인 바로가기</span></a> </div>]
'''
반응형
'[IT] > python' 카테고리의 다른 글
python.webcrawling.selenium.install (0) | 2021.02.02 |
---|---|
python.webcrawling.beautiful soap.html.tag/None/공백 제거 (0) | 2021.02.02 |
python.webcrawling.beautiful soap.html.parser (0) | 2021.02.02 |
python.webcrawling.beautiful soap.install (0) | 2021.02.01 |
python.pyQt5.QT designer.toSourceCode(designer에서 제작한 ui source code로 변환) (0) | 2021.01.28 |
python.pyQt5.QT designer with PyCharm(Qt designer과 PyCharm 연동) (0) | 2021.01.28 |
python.installer(실행파일 만들기) (0) | 2021.01.27 |
python.input data(input, sys.stdin, sys.stdin.readLine()) (0) | 2021.01.27 |
Comments