我尝试使用BeautifulSoup从HTML文件中获取一些字符串,每次使用它时,都会得到部分结果.
我想在每个li元素/标签中获取字符串.到目前为止,我已经能够像这样获得所有内容.
#!/usr/bin/python
from bs4 import BeautifulSoup
page = open("page.html")
soup = BeautifulSoup(page)
source = soup.select(".sidebar li")
我得到的是:
[
Def Leppard - Make Love Like A ManLive
,Inxs - Never Tear Us Apart
,Gary Moore - Over The Hills And Far Away
,Linkin Park - Numb
,Vita De Vie - Basul Si Cu Toba Mare
,Nazareth - Love Hurts
,U2 - I Still Haven't Found What I'm L
,Blink 182 - All The Small Things
,Scorpions - Wind Of Change
,Iggy Pop - The Passenger
]我只想从中得到琴弦.