# 来自jb51.cc# -*- enCoding:utf-8 -*-import Jsonimport warningswarnings.filterwarnings("ignore") if __name__=="__main__": import sys reload(sys) sys.setdefaultencoding( "utf-8" ) if len(sys.argv)==1: print "need argv" else: print sys.argv for Json_array in open('/home/spark/opt/Log_Data/Py_logproc/log_tmpdir/yemaopythonlog'): yemao_array = Json.loads(Json_array) for yemao in yemao_array: if not yemao.has_key('_reason'): time = yemao['time'] url_current = yemao['url_current'] phone = yemao['phone'] token = yemao['token'] f=open('/home/spark/opt/Log_Data/Py_logproc/log_tmpdir/xxxx.txt','a+') f.write('%d'%time+'|'+url_current+'|'+phone+'|'+token+'\n') f.close() print 'yemao_array_insert_file done'
总结 以上是内存溢出为你收集整理的python解析json数据并导出成普通文本示例全部内容,希望文章能够帮你解决python解析json数据并导出成普通文本示例所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)