zookeeper python接口实例详解
266
2022-08-24
Python之json(PYthon)
加载本地json:
with open('./test.json', 'r') as f: data = json.load(f)删除json中一个元素
# -*- coding=utf8 -*-import ioimport urllib2from urllib2 import urlopenfrom PIL import Imageimport jsonif __name__ == '__main__': with open('j', 'r') as f: data = json.load(f) ll = data['list'] for user in ll: if user['url'] == '5348728': print 'find it!' ll.remove(user) for user in data['list']: if user['url'] == '5348728': print 'find it!' with open('j', 'w') as f: f.write(json.dumps(data))
黄世宇/Shiyu Huang's Personal Page:https://huangshiyu13.github.io/
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~