![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python爬虫
李滇滇
这个作者很懒,什么都没留下…
展开
-
在beautifulsoup安装的前提下,报如下错误cannot import name
在beautifulsoup安装的前提下,报如下错误cannot import name ‘Beautifulsoup4’ from 'bs4’的解决办法1.检查自己脚本文件的命名是否命名成了bs4.py,如果命名成了bs4.py,程序则会在该文件下去找beautifulsoup,所以会报错。将文件名进行重命名即可。2.如果第一种办法不能解决,查看自己导入import beautifulsoup的写法,其中B和S都应该大写,否则也是找不到的。正确的写法为:from bs4 import Beautif原创 2021-11-14 13:59:27 · 1327 阅读 · 0 评论 -
Python 爬取豆瓣top250
#第一步,拿到源代码 requests#第二步拿到想要的数据 reimport reimport requestsimport csvfor page in range(0,226,25): url = "https://movie.douban.com/top250?start=%s&filter="%page print(url) header = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)原创 2021-11-13 22:21:19 · 332 阅读 · 0 评论