Python
恋上南山
这个作者很懒,什么都没留下…
展开
-
python中将字符串转为json对象并取值
string =" { "status": "error", "messages": ["Could not find resource or operation 'BZK1.MapServer' on the system."], "code": 404}"print '对象:' stringprint '取值:' json.loads(string)['code']输出结果为:原创 2018-03-19 14:36:55 · 46746 阅读 · 0 评论 -
Python判断json是否有key
string =" { "status": "error", "messages": ["Could not find resource or operation 'BZK1.MapServer' on the system."], "code": 404}"print '对象:' string输出结果为:对象:{u'status': u'error', u'code': 404,原创 2018-03-29 21:44:08 · 43912 阅读 · 2 评论 -
python删除文件中的文件方法
遍历文件夹下所有的文件,遇到文件删除,遇到文件夹继续遍历def del_file(path): for i in os.listdir(path): path_file = os.path.join(path, i) if os.path.isfile(path_file): os.remove(path_file) ...原创 2018-04-12 11:34:39 · 1315 阅读 · 0 评论