- 论坛徽章:
- 0
|
- #-*-coding=utf-8 -*-
- import re
- abc='''
- SUCC:_BOSSXML.MCN:MMOSReq:Retn=0000,Desc=处理成功,INFO=
- {"MMOSReq":{"MSISDN":"13822214928","FollowMSISDN":"15711728080","Seq":"0218BIP5A01120151031234446012952","OprCode":"06","BizType":"74","Channel":"70","ChrgType":"2","Category":"0","SerialNum":"1","EffectiveTime":"20151031234446","SPID":"698034","SPServID":"100000"}}{"_header":{"OrigDomain":"MOSP","SessionID":"SBIP5A01120151031234447104062","TransIDO":"BIP5A01120151031234447104062","TransIDOTime":"20151031234447","MsgSender":"2001"},"MMOSRsp":{"MSISDN":"13822214928","FollowMSISDN":"15711728080","Seq":"0218BIP5A01120151031234446012952","BizOrderResult":"0000","ResultDesc":"业务受理成功"
- ERROR:_BOSSXML.MCN:MMOSReq:Retn=2998,Desc=其他错误,INFO={"MMOSReq":{"OprCode":"06","MSISDN":"13888545543","SPID":"698034","SPServID":"100000","Seq":"0218BIP5A01120150901011849010345","FollowMSISDN":"15198712767","ChrgType":"2","Category":"0","SerialNum":"1","Channel":"70","BizType":"74","EffectiveTime":"20150901011849"}}{"_header":{"OrigDomain":"MOSP","SessionID":"SBIP5A01120150901011850021785","TransIDO":"BIP5A01120150901011850021785","TransIDOTime":"20150901011850","MsgSender":"0218"},"MMOSRsp":{"MSISDN":"13888545543","FollowMSISDN":"15198712767","Seq":"0218BIP5A01120150901011849010345","BizOrderResult":"2009","ResultDesc":"数据发生了错误,请核实!"
- SUCC:_BOSSXML.MCN:MMOSReq:Retn=0000,Desc=处理成功,INFO={"MMOSReq":{"OprCode":"06","MSISDN":"13411991736","SPID":"698034","SPServID":"100000","Seq":"0218BIP5A01120150831231225009207","FollowMSISDN":"14715500865","ChrgType":"2","Category":"0","SerialNum":"2","Channel":"04","BizType":"74","EffectiveTime":"20150831231225"}}{"_header":{"OrigDomain":"MOSP","SessionID":"SBIP5A01120150831231226019238","TransIDO":"BIP5A01120150831231226019238","TransIDOTime":"20150831231226","MsgSender":"2001"},"MMOSRsp":{"MSISDN":"13411991736","FollowMSISDN":"14715500865","Seq":"0218BIP5A01120150831231225009207","BizOrderResult":"0000","ResultDesc":"业务受理成功"
- .......
- '''
- values=['MSISDN','FollowMSISDN','BizOrderResult','ResultDesc']
- for value in values:
- pattern=r'"%s":"\S+?"'%value
- results=re.findall(pattern,abc)
- for result in results:
- print result.split(':')[1]
复制代码 瞎写了个,前两个有重的不过 |
|