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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章