TypeError: 'NoneType' object is not iterable in Python

问题:

What does error TypeError: 'NoneType' object is not iterable mean?错误TypeError: 'NoneType' object is not iterable是什么意思?

I am getting it on this Python code:我在这个 Python 代码上得到了它:

def write_file(data, filename): # creates file and writes list to it
  with open(filename, 'wb') as outfile:
    writer = csv.writer(outfile)
    for row in data: # ABOVE ERROR IS THROWN HERE
      writer.writerow(row)

解决方案:

参考一: https://en.stackoom.com/question/GJHh
参考二: https://stackoom.com/question/GJHh
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章