TypeError: object of type ‘NoneType‘ has no len()

TypeError: object of type ‘NoneType’ has no len()

参考:https://blog.csdn.net/xumesang/article/details/51221706
在这里插入图片描述
实际上是因为我这个变量并不是list,而且None,即没有初始值类型,len函数不能统计,这时,可以先判断一下,如果为None则直接退出
在这里插入图片描述

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_21237549/article/details/121771229