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' ...
随机推荐
- 【FAQ】HarmonyOS SDK 闭源开放能力 — Vision Kit(2)
1.问题描述: 人脸活体检测返回上一页App由沉浸式变为非沉浸式多了上下安全区域. 解决方案: 检测结束后需要自己去设置沉浸式配置. 2.问题描述: Vision Kit文字识别是本地识别,还是上传至 ...
- Qt编写物联网管理平台(支持win/linux/mac/嵌入式linux/modbus等)
一.前言 这个物联网综合管理平台前后迭代了五年,一点一滴慢慢积累起来,从最开始的只有modbus串口协议解析以及简单的表格显示数据,慢慢的逐渐增加了tcp_rtu支持,用户管理模块,地图监控模块,而后 ...
- 国产系统中标麒麟neokylin上的可视化大屏电子看板系统
一.功能特点 采用分层设计,整体总共分三级界面,一级界面是整体布局,二级界面是单个功能模块,三级界面是单个控件. 子控件包括饼图.圆环图.曲线图.柱状图.柱状分组图.横向柱状图.横向柱状分组图.合格率 ...
- Qt开源作品36-程序守护进程
一.前言 没有任何人敢保证自己写的程序没有任何BUG,尤其是在商业项目中,程序量越大,复杂度越高,出错的概率越大,尤其是现场环境千差万别,和当初本地电脑测试环境很可能不一样,有很多特殊情况没有考虑到, ...
- IDEA利用阿里云插件部署Springboot项目
下载插件 搜索 Alibaba Cloud Toolkit 插件,并安装. IDEA增加Run/Debug Configurations Add New Configuration - Deploy ...
- 记录一个uniapp写的小程序的手写板,横屏,用于签名,也可竖屏
今天需要在小程序增加一个手写板的功能,但是得横向的手写纵向的保存,直接上代码,竖屏的时候不需要旋转图片 <template> <view class="wrapper&qu ...
- shell脚本检查192.168.1网段ip是否在用
要检查 192.168.1 网段中哪些 IP 地址正在使用,可以使用 Shell 脚本结合 ping 命令来扫描整个网段.以下是实现这一功能的完整脚本: 脚本:检查 192.168.1 网段 IP 是 ...
- MySQL-进阶篇
一.连接查询 图解示意图 1.建表语句 部门和员工关系表: CREATE TABLE `tb_dept` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT ...
- 大语言模型(LLMs)隐私保护技术综述学习
链接:https://mp.weixin.qq.com/s/PCVHPxCwuciTR2BQCsAl4Q 原文:https://arxiv.org/abs/2408.05212
- TCA 复习
HTML中预览PDF 手机端无法识别embed <embed src="***.pdf" id="review" style="width:11 ...