12ํ์ด์ง ์ดํ print
๋จผ์ ๋ต๋ณ ๊ฐ์ฌ๋๋ ค์. ๋์๋ ๊ฐ๋๋ฐ์, 11ํ์ด์ง ๋ง์ง๋ง ๊ธฐ์ฌ๊น์ง๋ง ์ถ์ถ์ด ๋ผ์. ๊ทธ ์ดํ์๋ ํ์ด์ง๊ฐ 100๋๊ฒ๊น์ง ์๋๋ฐ, ๊ทธ๊ฑด ์ถ์ถ์ด ์ ๋๋ค์. ์๋ ์ฝ๋๋ก ํ์ด์. import requestsfrom bs4 import BeautifulSoupreq = requests.get("http://www.donga.com/news/List/Enter/?p=1&prod=news&ymd=&m=") # ์ํฐ์น๊ธฐsoup = BeautifulSoup(req.text, 'html.parser') ## ์ด๋ฐ ์์ผ๋ก HTMl์ ์๋ ์ฝ๋๋ฅผ ๋ค ๊ฐ์ ธ์จ๋คfor i in soup.select("#contents > div.page >a "): req2 = requests.get("http://www.donga.com/news/List/Enter/" + i['href']) # ํ์ด์ง๋ณ ๋์๋ค๋๊ธฐ soup2 = BeautifulSoup(req2.text, 'html.parser') for i in soup2.find_all("span", class_="tit") : print(i.text) # ๊ธฐ์ฌ ์ ๋ชฉ ๊ฐ์ ธ์ค๊ธฐ