Write file in excel within the Scrapy project [closed]

-2

I have a Spider that takes the xlsx links, in the Request I call the files and saved in:

def save_file(self, response):

    f = open("teste.xls", "wb")

    f = write(response.body)

    f.close()

But it returns the error:

f = write(response.body)
  

NameError: name 'write' is not defined

Can anyone help me solve this problem?

    
asked by anonymous 09.05.2018 / 17:47

1 answer

0
def save_file(self, response):

f = open("teste.xls", "wb")

f.write(response.body)

f.close()

You were wrong on

f = write(response.body)

You assigned the variable "f" the value write (), but write is not a function.

    
09.05.2018 / 21:25