We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
with open(fileName, "a+") as f: # 不同人的名言保存在不同的txt文档,“a+”以追加的形式 f.write(text) f.write('\n') # ‘\n’ 表示换行 f.write('标签:' + tags) f.write('\n-------\n') f.close() 是不是不需要f.close()了
The text was updated successfully, but these errors were encountered:
楼主的这种写法只是简单的描述一下抓取的过程, 更加严谨一点: 可以把对文件的open &保存数据 &close 放到pipelines.py中处理。这样所有的内容就保存到一个文件中了,不会再分成几个文件了,在argsSpider.py中,通过css解析,每次把结果只需要调用 yield item,同时把settings.py中该配置打开即可 ITEM_PIPELINES = { 'argSpider.pipelines.ArgspiderPipeline': 300, }
Sorry, something went wrong.
No branches or pull requests
with open(fileName, "a+") as f: # 不同人的名言保存在不同的txt文档,“a+”以追加的形式
f.write(text)
f.write('\n') # ‘\n’ 表示换行
f.write('标签:' + tags)
f.write('\n-------\n')
f.close()
是不是不需要f.close()了
The text was updated successfully, but these errors were encountered: