【发布时间】:2019-10-19 00:54:54
【问题描述】:
我正在从 IMDB 中提取评论数据。
但是,有时也有没有排名的数据。
我想将此类数据的 Rank 视为 0 并将其添加到数组中。
我不知道怎么做。
你能帮帮我吗?
非常感谢!
这样提取时,Rank值较低。
for star in soup.select('span:has(~ .point-scale)'):
Star.append(star.text.strip());
for title in soup.find_all('a', {'class' : 'title'}):
Title.append(title.text.strip())
for content in soup.find_all(True,{'class' :[text show-more__control'
,'text show-more__control clickable]}):
Content.append(content.text.strip())
print(range(len(Content)))
【问题讨论】:
-
请在您的问题文本中包含任何必要的信息。您的代码图片不合适。见Why not upload images of code?
-
嗨 Cyp,除了“web image”,其他两个 sn-ps 可以很容易地作为文本包含在您的问题中。请这样做,正确格式化它们,然后(再次在您的问题中)解释“[评级]部分缺失”的意思;而你所期望的。只有这样我们才能尝试回答您的问题。
-
@khelwood,@minsago 抱歉,我添加了更多解释。
标签: python beautifulsoup web-crawler