Home > other >  Early learning pyquery reptiles have a question want to ask the great spirit
Early learning pyquery reptiles have a question want to ask the great spirit

Time:11-03

As shown in picture why each time crawl data save only the first page of article 20 or article 20 of the last page of the article but the display is normal in the software for don't know where is wrong pursuing big guy to help me look

CodePudding user response:

Because you are using with the open way of speaking, reading and writing is a 'w', and in the for loop, every time to open a blank TXT file,

Recommendations will be 'w' is replaced by 'a +', or will be with the open wrote a for loop

CodePudding user response:

W model, automatically to empty file at a time, to write new content, so the for loop, with each cycle to empty time, until the last time for loop can be preserved,
A model, at the end of the original file content is to add content, not to empty the original file,
You should use a

CodePudding user response:

reference 1/f, archaeologists lx response:
because you use with the open way of speaking, reading and writing is a 'w', and in the for loop, every time to open a blank TXT file,

Recommendations will be 'w' is replaced by 'a +', or will be with the open wrote above for loop
thank you

CodePudding user response:

refer to the second floor max5173 response:
w model, automatically to empty file at a time, to write new content, so the for loop, with each cycle to empty time, until the last time for loop can be preserved,
A model, at the end of the original file content is to add content, not to empty the original file,
You should use a
thank you very much
  • Related