def __init__(self): # super(JsonExporterPipelines,self).__init__(self.file) JsonLinesItemExporter.__init__(self, file) self.file = open('./data/data.json', 'wb') # 初始化 exporter 实例,执行输出的文件和编码 # self.exporter = JsonLinesItemExporter(self.file,encoding='utf-8',ensure_ascii=False) # 开启写入 self.start_exporting() # self.exporter.export_empty_fields = True self.first_item = True