python beautifulsoup findall p标签

时间:2012-01-13 19:02:19

标签: python beautifulsoup

def GetDescription(self, Soup):

descriptionList = []

description = str(Soup.find('div', class='productDescriptionSource').findAll('p'))

print description

我因class而收到错误。我需要逃脱角色吗?怎么做?谢谢!

2 个答案:

答案 0 :(得分:2)

您需要将代码编辑为:

Soup.findAll("div",{"class":"productDescriptionSource"})

答案 1 :(得分:0)