
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
3-15강 지니뮤직에서 순위표를 크롤링 하는 숙제 중 궁굼한 점이 생겨 질문 드립니다.
지니뮤직에서 순위표를 크롤링하여 순위, 타이틀, 가수명 순으로 결과값을 보게 하는 숙제인데
첫번째 코드
songs = soup.select('#body-content > div.newest-list > div > table > tbody > tr')
for song in songs:
rank = song.select_one('td.number').text[0:2].strip()
title = song.select_one('td.info > a.title.ellipsis').text.strip()
artist = song.select_one('td.info > a.artist.ellipsis').text
print(rank, title, artist)
이런식으로 코드를 입력하였을 때

19금이 붙은 노래가 존재하고 19금과 노래제목 사이 공백이 지워지지 않아 일단 19금부터 지워보려 replace를 사용했습니다.
두번째 코드
songs = soup.select('#body-content > div.newest-list > div > table > tbody > tr')
for song in songs:
rank = song.select_one('td.number').text[0:2].strip()
title = song.select_one('td.info > a.title.ellipsis').text.replace('19금', '').strip()
artist = song.select_one('td.info > a.artist.ellipsis').text
print(rank, title, artist)
replace('19금', '') 같이 입력하여 19금을 빈문자열로 바꿔주고 "줄 바꿈(/n) ?" 을 지워보려했는데

19금만 바꾸어 주었음에도 공백? 줄바꿈? 까지 사라져서 왜 함께 사라진지 궁굼하여 질문을 드립니다.
다시 질문을 정리하면
.jpg)
입니다!
