Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 删除json文件中的一些行_Python_Json - Fatal编程技术网

Python 删除json文件中的一些行

Python 删除json文件中的一些行,python,json,Python,Json,我有一个json文件: 我想删除此文件中的某些行,如下所示: 我怎样才能用python脚本做到这一点?你刚才不是问了这个吗?不明白你想告诉我什么吗?很抱歉 import json data = json.loads(open("input.json").read()) with open("output.json", "w") as outfile: json.dump(data["Stock"]["Vehicule"], outfile)

我有一个json文件:

我想删除此文件中的某些行,如下所示:


我怎样才能用python脚本做到这一点?

你刚才不是问了这个吗?不明白你想告诉我什么吗?很抱歉
import json
data = json.loads(open("input.json").read())
with open("output.json", "w") as outfile:
        json.dump(data["Stock"]["Vehicule"], outfile)