scrapy爬取招聘网站,items转换成dict遇到的问题

1 import json 2 3 class TencentJsonPipeline(object): 4 def __init__(self): 5 self.file = open('tencent.json','wb') 6 7 def process_item(self, item, spider): 8 content = json.dumps(dict(item),ensure_ascii=False)+"\n" 9 self.file.write(content) 10 return item 11 def close_project(self): 12 self.file.close()

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zydfgx.html