当前位置:网站首页>Script loads data into JSON file
Script loads data into JSON file
2022-07-22 00:47:00 【Fan zhidu】
import json
from itemadapter import ItemAdapter
class LianjiaPipeline:
def open_spider(self, spider):
self.file = open('lianjia.json', 'a', encoding='utf-8')
def close_spider(self, spider):
self.file.close()
def process_item(self, item, spider):
line = json.dumps(ItemAdapter(item).asdict(), ensure_ascii=False) + "\n"
self.file.write(line)
return item
stay pipeline Add the above code to the file
边栏推荐
猜你喜欢
Download of typora and use of markdown
【高级数据处理技术】数据过滤,高级数据填补,初,高级数据转化
TypeScript(二)
Comment les applets utilisent la barre de navigation personnalisée
数据可视化第五章
根据返回的图片和坐标,画出在图片上的对应的矩形框
The 64 bit version of Visio cannot be installed because the following 32-bit program solution is found on your PC
“买不来”的数字化转型,每家的“乐高”都不同
绘制板块图层
How to join enterprise wechat group chat with applets
随机推荐
whistle ERR_CERT_AUTHORITY_INVALID
mysql dense_rank(), rank() 函数
Structured analysis SD SASP
统计一年中每个月的数据
机器学习K-均值——nonzero(clusterAssment[冒号,0].A==cent
oracle创建表空间及查看表空间和使用情况
TypeScript(二)
获取header和cookie的简易方法
传统企业是否需要数据中台?
Counterfeit money problem
[natural language processing and text analysis] overview of natural language processing
解决FTPClient上传文件为空,显示0字节
2694: inverse Polish expression
[natural language processing and text analysis] summary of text feature extraction methods. Keyword extraction method. IDF and RCF with good effect are recognized.
小程序 如何上传多张图片
Applet Basics
Replay attack as defense
匹配任意两个字符的中间字符 RE
教你破解电脑五种开机密码方法
scrapy pipeline中mysql和mongo数据库入库