1
我的工作是由有2場,URL和標題的HTML頁面檢索列表中的代碼...Python中添加一個字符串匹配列表與多個項目
的URL反正有/URL....
啓動,並我需要附加「http://website.com」給每個從re.findall
返回的變化。
到目前爲止的代碼是這樣的:
bsoup=bs(html)
tag=soup.find('div',{'class':'item'})
reg=re.compile('<a href="(.+?)" rel=".+?" title="(.+?)"')
links=re.findall(reg,str(tag))
*(append "http://website.com" to the href"(.+?)" field)*
return links
http://stackoverflow.com/a/1732454/1459669請使用美麗的湯來找到鏈接! –
@CrazyPython除非你想召喚克蘇魯。 – timgeb
@timgeb你永遠不知道,他可能想要召喚他。然後我們需要將它遷移到StackExchange Skeptics或Worldbuilding ... –