AI智能
改变未来

已解决:ValueError: I/O operation on closed file.


运行爬虫文件一直出现如下错误:

Traceback (most recent call last):
File “D:/PyCharm1/workspace/AutoLogin/test/test1.py”, line 72, in
main()
File “D:/PyCharm1/workspace/AutoLogin/test/test1.py”, line 69, in main
find_Computer(URL,headers=headers)
File “D:/PyCharm1/workspace/AutoLogin/test/test1.py”, line 57, in find_Computer
write.writerow(row)
ValueError: I/O operation on closed file.

代码如下


问题是出现缩进错误,与for循环同级,即可解决

运行正常!!!

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » 已解决:ValueError: I/O operation on closed file.