
강사님께서 해주신 코드와 제가 한 코드에 큰 차이가 없어 보이는데,

15위에 있는
<a href="#" class="title ellipsis" title="재생" onclick="fnPlaySong('92682943','1');return false;">
<span class="icon icon-19">19<span class="hide">금</span></span>
Peaches (Feat. Daniel Caesar & Giveon)</a>
<span> 태그가 문제입니다. ㅠㅠ

<span> 태그로 인해서 벌어진 것같은 이 격차는 어떻게 해야 할까요?
제가 입력한 코드입니다.
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get('https://www.genie.co.kr/chart/top200?ditc=M&rtm=N&ymd=20210701',headers=headers)
soup = BeautifulSoup(data.text, 'html.parser')
#body-content > div.newest-list > div > table > tbody > tr:nth-child(1) > td.info > a.title.ellipsis
#body-content > div.newest-list > div > table > tbody > tr:nth-child(2) > td.info > a.title.ellipsis
#body-content > div.newest-list > div > table > tbody > tr:nth-child(17) > td.number
#body-content > div.newest-list > div > table > tbody > tr:nth-child(17) > td.info > a.albumtitle.ellipsis
music = soup.select('#body-content > div.newest-list > div > table > tbody > tr')
for musics in music:
title = musics.select_one('td.info > a.title.ellipsis').text.strip()
rank = musics.select_one('td.number').text[0:2].strip()
singer = musics.select_one('td.info > a.albumtitle.ellipsis').text
print(rank , title, '(',singer,')')
