try:
link = music.find_all("a")
#print link
for link_music in link:
music= link_music.get('href')
print music
musicData['Link'].append(music)
except:
musicData['Link'].append("")
dr = pd.DataFrame(musicData)
dr
我试图只获得' href'用' http'在它..但.get(href)也得到了#'#'
try:
link = music.find_all("a")
#print link
for link_music in link:
music= link_music.get('href')[2:]
#print music
musicData['Link'].append(music)
except:
musicData['Link'].append("")
dr = pd.FataFrame(musicData)
dr
以[2:],我得到了' href'但是对于一些令人反感的事情而言。从https://被删除,表格如图2所示填充。
如何使数据框架只有' http href'