杨魅力
给你一个demo,分词什么你自己来吧,用到pandas,json。importpandasaspdimportjsona='{"msgid":"8280204259419051","msgpriority":0,"msgtext":"PTV-8698|8280204259419051|function(){}|1498722414739|257|!206!3041!0!0!1!CCTV-1综合(高清)","receiverid":"data","senderid":"8280204259419051","subjectid":"data.stb.report"}\n{"msgid":"0","msgpriority":0,"msgtext":"HC3100||ec-f4-bb-da-4c-e4|599925|257|1!5!501!0!0!2!CCTV-2财经","receiverid":"data","senderid":"0","subjectid":"data.stb.report"}'array=a.split('\n')data=[]foreachinarray:data.append(json.loads(each,encoding='gbk'))res=pd.DataFrame()foreachindata:res=res.append(pd.DataFrame(each,index=[0]))res.index=range(len(data))res.to_csv('res.csv')