TypeError: 'NoneType' object is not iterable 一次错误场景
TypeError: 'NoneType' object is not iterable
源码
def get_url(lines):
urls=[]
for line in lines:
if 'img' in urls:
url=line.split('src=')[-1].split('"')[1]
urls.append(url)
def outputto(urls):
count=0
for line in urls:
print('第{:2}个url为{}'.format(count,line))
count=count+1
意思是urls里面的内容为空
向上找发现 上面的get_url 函数未添加return 返回值
需要在下面的函数调用,所以返回报错
运行后在for line in urls 报错

TypeError: 'NoneType' object is not iterable 一次错误场景的更多相关文章
- python TypeError: 'NoneType' object is not iterable
list(set(map(lambda tp_id : tp_id if not ('#' in tp_id) and len(tp_id.strip().replace('\n', '')) > ...
- python"TypeError: 'NoneType' object is not iterable"错误解析
尊重原创博主,原文链接:https://blog.csdn.net/dataspark/article/details/9953225 [解析] 一般是函数返回值为None,并被赋给了多个变量. 实例 ...
- append导致TypeError: 'NoneType' object is not iterable
a=[1,2,3] a.append(4) a Out[4]: [1, 2, 3, 4] a=a.append(5) print(a) None a =[1,2,3] print(a.append(4 ...
- 'NoneType' object is not iterable
"TypeError: 'NoneType' object is not iterable" 一般是返回值为None同时赋值给了多个变量
- Python问题:'Nonetype' object is not iterable
参考链接:http://blog.csdn.net/dataspark/article/details/9953225 [解析] 这个错误提示一般发生在将None赋给多个值时. [案例] 定义了如下的 ...
- TypeError: 'NoneType' object is not subscriptable
运行,显示TypeError: 'NoneType' object is not subscriptable错误信息,原因是变量使用了系统内置的关键字list 重新定义下这个变量就好了
- TypeError: 'ExcelData' object is not iterable
今天写了个测试的代码,结果在执行test_register.py文件在调用readexcle.py的时候一直报错TypeError: 'ExcelData' object is not iterabl ...
- TypeError: 'TestCase' object is not iterable
这个异常呢其实是因为我对list没有足够熟悉 我一开始很疑惑,明明已经正确返回testcase对象了呀,为啥会报TypeError: 'TestCase' object is not iterable ...
- python报错Nonetype object is not iterable
https://www.cnblogs.com/zhaijiahui/p/8391701.html 参考链接:http://blog.csdn.net/dataspark/article/detail ...
- Python : TypeError: 'int' object is not iterable
用循环依次对list中的每个名字打印出 Hello, xxx! -------------------------------------------------------- L = ['Bart' ...
随机推荐
- 【XML】学习笔记第三章-namesapce
目录 命名空间 命名空间概述 命名空间语法 命名空间的声明 命名空间作用域 对命名空间的使用 元素对命名空间的使用 属性对命名空间的使用 DTD对命名空间的支持 命名空间 命名空间概述 标记中出现了同 ...
- Consul health check pass by Spring security filter
https://stackoverflow.com/questions/35079930/consul-health-check-pass-by-spring-security-filter By d ...
- Mac触控板设置以及使用
Mac 触控板体验是非常好的,很多同学甚至直接用触控板代替鼠标操作,但是默认设置中有一些功能是没有开启的,需要手动配置. 本文就来说说 如何更改 Mac 触控板默认设置,让触控板变得更高效. 一.启用 ...
- 3款.NET开源、功能强大的通讯调试工具,效率提升利器!
前言 今天大姚给大家分享3款.NET开源.功能强大的通讯调试工具,帮助大家提高通讯调试的效率和准确性. LLCOM LLCOM是一个.NET开源的.功能强大的串口调试工具.支持Lua自动化处理.串口调 ...
- Qt开发经验小技巧91-100
数据库处理一般建议在主线程,如果非要在其他线程,务必记得打开数据库也要在那个线程,即在那个线程使用数据库就在那个线程打开,不能打开数据库在主线程,执行sql在子线程,很可能出问题. 新版的QTcpSe ...
- [转]C# 组合查询条件
在我们开发过程中经常会遇见一些通过条件获取数据的功能,比如说获取我们的用户信息,查询输入框有用户姓名,部门,入职年份等等,但查询时可能只输入一个条件或多个条件,像这种不确定的查询时,我们应该如何处理. ...
- OpenMMLab AI实战营 第五课笔记
OpenMMLab AI实战营 第五课笔记 目录 OpenMMLab AI实战营 第五课笔记 在气球数据集上训练检测模型 进入 mmdetection 主目录 下载并观察气球数据集 下载训练好的mas ...
- 「V 曲闲谈」《一半的梦》——“模糊”&「NOIP 2022」未游之记
好久没写闲谈了欸.现在雨兔正坐在家里的台式机前,开着腾讯会议监控自习,但是她悄悄打开记事本,bilibili 单曲循环<一半的梦>(系统 Vol=2,兔耳朵真好使). 感谢 Rai ...
- 前端(二)-CSS
1.样式 1.1 行内样式 <h1 style="color:red;">行内样式</h1> 1.2 内部样式 CSS代码写在 <head> 的 ...
- 一文搞懂企业架构与DDD融合
大家好,我是汤师爷~ 今天聊聊企业架构与DDD如何进行融合. 企业架构TOGAF 什么是企业架构TOGAF? TOGAF(The Open Group Architecture Framework)是 ...