【发布时间】:2020-02-16 07:19:00
【问题描述】:
我正在尝试查看特定字符串是否在表中。所以我试图用soup.find all 找到它。 我的代码是:
for i in soup:
tmp = soup.findAll("td", {"class": "spec-name"})
tmp2 = soup.findAll("td", {"class": "spec-value"})
str1 = tmp[i]
str2 = tmp[i+1]
if ('Touch' in str1 and 'yes' in str2 or 'Screen' in str1 and 'YES' in str2):
IsTouch = "touch screen, "
FIsTouch = 'yes'
if ('Touch' in str1 and 'NO' in str2 or 'Screen' in str1 and 'No' in str2):
IsTouch = "not screen touch"
FIsTouch = 'no'
break
我想看看“是”是否与“触摸”类别内联
但是 - 我得到了除了。
我做错了什么?
【问题讨论】:
-
有什么异常?
标签: python beautifulsoup web-crawler findall