SON#51
이메일 패턴 찾기
import re
import requests
from bs4 import BeautifulSoup
# 크롤링할 URL
url = 'https://www.naver.com/'
# HTML 가져오기
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
# HTML에서 텍스트 추출
text = soup.get_text()
# 정규 표현식 패턴: 이메일 주소 찾기
email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
# 이메일 주소 찾기
emails = re.findall(email_pattern, text)
# 추출한 이메일 주소 출력
for email in emails:
print(f"찾은 이메일 주소: {email}")로그인한 상태로 이메일 찾기를 했는데 왜 못찾는 건가요?
댓글
댓글이 없습니다.