已解决: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.

代码如下

已解决:ValueError: I/O operation on closed file._第1张图片
问题是出现缩进错误,与for循环同级,即可解决
已解决:ValueError: I/O operation on closed file._第2张图片
运行正常!!!

你可能感兴趣的:(爬虫,python)