什么是TypeError: 'NoneType'对象是不可迭代的意思?例子:
for row in data: # Gives TypeError!
print(row)
什么是TypeError: 'NoneType'对象是不可迭代的意思?例子:
for row in data: # Gives TypeError!
print(row)
当前回答
表示data的值为None。
其他回答
表示data的值为None。
你用这样的参数调用write_file:
write_file(foo, bar)
但是你没有正确地定义'foo',或者你在你的代码中有一个拼写错误,所以它创建了一个新的空变量并传入它。
当你得到None Exception时,继续循环,
例子:
a = None
if a is None:
continue
else:
print("do something")
这可以是来自DB或excel文件的任何可迭代对象。
这意味着data的值为None。
这意味着数据变量传递的是None(类型为NoneType),它的等效值为空。所以它不能像你尝试的那样,作为一个列表是可迭代的。