findAll() 이나 find() ☞ 함수를 쓰면 html 페이지에서 원하는 두 함수는 거의 비슷하다.
findAll(tag, attributes, recursive, text, limit, keywords)
find(tag, attributes, recursive, text, keywords)
findAll( ) ☞ html 태그에서 반복되는 태그를 찾아 처리할 때 효과적이다.
for div in soup.findAll('div', {'class': 'product_tile'}):
p_tag = div.find('a', {'class': 'product_name desktop_content tablet_content'}).getText()
name_tag = div.find('div', {'class': 'product_subtitle'}).getText()
span_tag = div.find('p', {'class': 'product_price price_sale b-product_price-sale b-product_price'}).getText()
img_tag = div.find('img')
print(p_tag.strip())
print(name_tag.strip())
print(span_tag.strip())
print(img_tag.get('data-desktop-src').strip())
'python' 카테고리의 다른 글
파이썬 서버 구축 (0) | 2018.12.30 |
---|---|
python oracle 디비에 넣기 (+oracle DB넣기) (0) | 2018.12.28 |
파이썬 오라클 연동 [python install oracle] (0) | 2018.12.28 |
파이썬 웹크로링 및 엑셀정리 (0) | 2018.12.24 |