re활용 예제

from bs4 import BeautifulSoup

import re


html = """<html><head><title>title name</title></head><body><p>test</p></body></html>"""


soup = BeautifulSoup(html, 'lxml')

html_content = soup.find_all('html')


print(soup.find_all(re.compile('원하는 정규식')))

print(soup.find_all(class_=re.compile('원하는 정규식')))



'웹 서버 > 크롤러' 카테고리의 다른 글

bs4 함수  (0) 2018.05.16
bs4  (0) 2018.05.16
urllib 모듈  (0) 2018.05.15
requests 모듈  (0) 2018.05.15
requests VS urllib  (0) 2018.05.15

+ Recent posts