뉴스의 제목이 하나 만 출력됩니다
339
sk a
작성한 질문수 4
0
안녕하세요. 뉴스의 제목과 링크를 가져오기 강의에서
제목이 여러개 인데 하나 만 출력되네요
import requests
from bs4 import BeautifulSoup
response = requests.get('https://search.naver.com/search.naver?where=news&sm=tab_jum&query=%EC%82%BC%EC%84%B1%EC%A0%84%EC%9E%90')
html = response.text
soup = BeautifulSoup(html,'html.parser')
links = soup.select('.news_tit')
for link in links:
title = link.text
url = link.attrs['href']
print(title,url)
답변 2
0
for link in links:
title = link.text
url = link.attrs['href']
print(title,url)이런식으로 마지막 코드를 들여쓰기 해주셔야 합니다 :)
for 명령어의 동작방식을 아래 영상으로 다시 한번 학습해 보세요 ㅎㅎ
https://youtu.be/j58o7UU2kNs?list=PLNO7MWpu0eeVfqT9ehXWf9CdRALusjUsU
강의 수강 후 포트폴리오 준비 방향에 대해 조언 부탁드립니다.
2
47
1
4. Container 빌드 & 저장하기 - 자료 관련
1
34
2
클로드 스킬 기능(hwpx 채우기)과 유사한 기능을 하는 다른 AI모델 문의
1
32
1
session이 점점 길어지면 어떻게 대처하나요?
1
61
1





