更新时间:2022-11-12 15:46:41
如果没有看到堆栈跟踪很难确定,但我怀疑这一行:
It's hard to say for sure without seeing the stack trace, but I suspect this line:
imageFile.write(urllib.urlopen(filename)).read()
应该是:
imageFile.write(urllib.urlopen(filename).read())
顺便说一句,您不需要 imageFile.close()
行,因为 with
语句会自动为您关闭文件.
Incidentally, you don't need the imageFile.close()
line, because the with
statement closes the file for you automatically.