源码:爬虫文件中,管道文件中
item['positionName'] = node.xpath("./td[1]/a/text()").extract()[0].encode("utf-8")
self.f.write(content)
此时运行报错
TypeError: Object of type bytes is not JSON serializable
类型字节的对象不是JSON可序列化的,网上查找资料,只需在管道文件中更改文件类型
item['positionName'] = node.xpath("./td[1]/a/text()").extract()[0]
self.f.write(content.encode("utf-8"))