python nonetype object has no_为什么会出现这个?'NoneType' object has no attribute 'contet
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
import urllib.request
from bs4 import BeautifulSoup
def get_page(url):
kv = {'User-Agent': 'Mozilla/5.0', 'Cookie':'BAIDUID=0156185E725928F549DB48FE0A1DDE69:FG=1; PSTM=1551762939; BIDUPSID=63EAE36946BA95A4145B1A726A4422A2; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; CPROID=0156185E725928F549DB48FE0A1DDE69:FG=1; locale=zh; delPer=0; H_PS_PSSID=1432_21111_28608_28584_28557_28518_28625_28606; PSINO=7; ISBID=0156185E725928F549DB48FE0A1DDE69:FG=1; ISUS=0156185E725928F549DB48FE0A1DDE69:FG=1'}
req = urllib.request.Request(url, headers=kv)
response = urllib.request.urlopen(req)
html = response.read().decode('utf-8', 'ignore')
return html
def find_img(html):
soup = BeautifulSoup(get_page(html), 'html.parser')
my_girl = soup.find_all('img')
for girl in my_girl:
link = girl.get('src')
return link
def save(link):
root = "D://pics//"
path = root + link.split('/')[-1]
r = find_img(link)
with open(path, 'wb') as f:
f.write(r.content)
f.close()
def main():
url = 'https://www.dbmeinv.com/'
pages = 6
for i in range(pages):
i += 1
page_url = url + '?pager_offset=' + str(i)
link = find_img(page_url)
save(link
main()
python nonetype object has no_为什么会出现这个?'NoneType' object has no attribute 'contet相关推荐
- python构造函数在创建对象时,没有自动执行,object has no attribute
新手踩坑,python构造函数在创建对象时,没有自动执行,object has no attribute 刚开始学python,照着书敲,就离谱,一直在报错object has no attribut ...
- 运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法
运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法 参考文章: (1)运行pyt ...
- Warning message:In a + b : longer object length is not a multiple of shorter object length
Warning message:In a + b : longer object length is not a multiple of shorter object length 目录 Warnin ...
- python的moviepy库 打包 报错: ‘moviepy.audio.fx.all‘ has no attribute ‘audio_fade 的解决办法
本篇文章主要讲解python的moviepy库 打包 报错: 'moviepy.audio.fx.all' has no attribute 'audio_fade 的解决办法 日期:2022年3月9 ...
- python中引入包的时候报错AttributeError: module ‘sys‘ has no attribute ‘setdefaultencoding‘解决方法?
python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法? 参考文章: (1)pyth ...
- NET:Error Creating Control -Object Reference Not Set To An Instance Of Object
这几天,竟遇见些奇葩问题,有的实在懒的写了,这个比较有意思,以前没见过,写个文章记录下: Error Creating Control -"Object Reference Not Set ...
- python中nonetype object has no_为什么会出现这个?'NoneType' object has no attribute 'contet...
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 import urllib.request from bs4 import BeautifulSoup def get_page(url): kv = { ...
- Python导入模块(包)的两种方式 TypeError: 'module' object is not callable
Python编程时明明在开始处import了相关包,但是调用函数时就报错如下: TypeError: 'module' object is not callable Python中有两种导入包(模块, ...
- python中object是什么类型_Python 的 type 和 object 之间是怎么一种关系?
class,metaclass,instance,subclass,base 以下成立: 对任意的A,A是instance(推论:任意class也是instance) 对任意A,存在B,使得B是A的c ...
最新文章
- java 异常 理解_java中的异常理解
- cocos2d-x知识总结
- html:(24):内联式css和嵌入式css
- html页面的css样式、meta最常用的最基本最常规的配置参数
- Zookeeper启动和Leader选举机制
- ASP.NET Report Starter Kit视频教程--1
- java webservice用户验证_java webservice 用户验证 (服务端 + 客户端)
- Hard To Get歌词分析
- idea的工具栏显示
- 百度地图图层开发java_Android百度地图应用之图层展示
- 网站建设流程是什么?
- 硬派健身——健身先健脑
- 笔记7.28 数据库经典问题
- c语言atm程序个人总结,C语言程序设计报告(模拟ATM取款机)
- Maxcompute sql 练习题
- 扰码器原理详解及verilog实现
- python 网络唤醒电脑WOL
- 电信云堤·抗D(电信云堤清洗高防服务器)提供超强T级DDoS处理能力
- QT+opencv实时显示视频
- latex--图片并排和插入pdf格式图片
热门文章
- SAP Spartacus cxPageTemplateStyle Directive的作用
- fixture.detectChange是如何触发Component view的ngOnInit钩子的
- SAP Spartacus split view里每个元素宽度的计算方式
- Angular NgTemplateOutlet的一个例子
- SAP CRM One Order header数据库表几个和时间戳相关的字段
- Kyma registration of webservices and event endpoints
- SAP云平台里两种类型的WebIDE
- 如何给Wordpress安装插件
- localsandbox 如何响应tile点击事件
- local path of sap-ui-core-less-140903345-dbg.js