遇到問題1:write() argument must be str, not bytes
對應的源碼爲
def parse(self, response):
filename = "teacher.html"
open(filename, 'w').write(response.body)
原因:打開文件的格式有問題,追加一個打開文件的格式參數b+ ,以二進制的方式打開就可以了.
def parse(self, response):
filename = "teacher.html"
open(filename, 'wb+').write(response.body)