728x90 반응형 bs41 [Python] BeautifulSoup select() CSS 선택자 사용법 BeautifulSoup(html, 'html.parser').select()select() 메서드는 HTML 문서에서 CSS 선택자 규칙에 맞는 모든 태그를 리스트 형태로 반환 예제 HTML 코드# HTML 문서를 파싱하여 soup 객체 생성from bs4 import BeautifulSouphtml = """ The Dormouse's story Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; """soup = BeautifulSoup(html, 'html.parser')활용태그 이름으로 찾기soup.select("title")# 결과: [The Dormou.. 2024. 11. 17. 이전 1 다음 728x90 반응형