鱼C论坛

 找回密码
 立即注册
查看: 1540|回复: 1

[已解决]爬虫教程里打印不出来

[复制链接]
发表于 2020-8-8 20:22:53 | 显示全部楼层 |阅读模式
10鱼币
  1. >>> import requests
  2. >>> import bs4
  3. >>> res = requests.get("https://movie.douban.com/top250")
  4. >>> soup = bs4.BeautifulSoup(res.text, "html.parser")
  5. >>> targets = soup.find_all("div", class_="hd")
  6. >>> for each in targets:
  7. print(each.a.span.text)
复制代码
爬取豆瓣TOP250电影排行榜(有彩蛋)
https://fishc.com.cn/thread-94979-1-1.html
(出处: 鱼C论坛)
不知道什么问题一直什么都不出现?(print(each.a.span.text)这句复制过来缩进自己没了




最佳答案

查看完整内容

https://fishc.com.cn/thread-155756-1-1.html
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-8-8 20:22:54 | 显示全部楼层    本楼为最佳答案   
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-25 03:08

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表