python

[python] crawling method by partial ids

9won 2019. 8. 15. 21:56
반응형

for example

- <tr id="abc1"> ... <tr id="abc2"> ... <tr id="abc9">

 

===================================

 

 

from bs4 import BeautifulSoup

import re

 

driver.get('http://aigwon.tistory.com')

html = driver.page_source

bsObject = BeautifulSoup(html,"html.parser")

 

crawling_test = bsObject.findAll('tr', id=re.compile('^abc-'))

 

 

반응형