250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- mysql
- oracle
- test
- 토픽추출
- 과학백과사전
- RESFUL
- jsp 파일 설정
- java
- Gmarket
- Topics
- 幼稚园杀手(유치원킬러)
- 자바
- db
- pytorch
- r
- lda
- Websocket
- 코사인 유사도
- 게시판 만들기
- 방식으로 텍스트
- 파이썬
- 크롤링
- tomoto
- spring MVC(모델2)방식
- (깃)git bash
- Python
- word2vec
- 이력서
- 네이버뉴스
- 지마켓
Archives
- Today
- Total
무회blog
python: python 파이썬 # html 태그 제거 본문
import requests
from bs4 import BeautifulSoup
import re
rq = requests.get("naver.com")
print(type(rq)) #<class 'requests.models.Response'>
rqctnt = rq.content
print(type(rqctnt)) # <class 'bytes'>
soup = BeautifulSoup(rqctnt,"html.parser")
print(type(soup)) # <class 'bs4.BeautifulSoup'>
OMG = str(soup.find_all("p"))
print(type(OMG)) # <class 'str'>
OMG = re.sub('<.+?>', '', OMG, 0).strip() # html 태그 제거
print(OMG)
'Python' 카테고리의 다른 글
python: 파이썬(python) mod1.py 파일쓰기 (open함수_import) (0) | 2020.05.07 |
---|---|
Python # 파이썬 + - * / 연산을 할수 있는 클래스 (파이썬클래스) + 상속 (1) | 2020.05.07 |
python: 파이썬 특정 문자 개수 세어 보기 (0) | 2020.04.26 |
requets Beautiful Soup 로 네이버 실시간 검색어 크롤링(스크래핑) 하기 (2) | 2020.04.25 |
파이썬 파일 전처리 0424 (0) | 2020.04.24 |
Comments