Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前,我使用 scrapy 爬取网页的多个页面并将数据导出到 CSV 文件。每天,蜘蛛都会爬取页面并保存数据;但是,它将覆盖前几天的数据。我想知道如何对管道进行编程,以便它从文件末尾开始写入同一个文件中的 CSV。通过这种方式,我可以将所有以前抓取的数据保存在一个地方。
通常只需将打开文件例程中的参数更改为追加
改变
f = open('filename.txt','w')
至
f = open('filename.txt','a')
当然,如果我们能看到您的原始代码,这将有助于我们更加具体。