# -*- coding:utf-8 -*-
import re
s=u'[{"timestamp":1462590135,"rawXML":"<\/id> <\/username> <\/createTime> 0<\/contentDescShowType> 4<\/contentDescScene> <\/private> <\/contentDesc> <\/contentattr> <\/sourceUserName> <\/sourceNickName> <\/statisticsData> <\/location> <\/contentStyle> <\/title> <\/description>
m=re.compile('(.*)<\\\/username>')
print re.search(m, s).groups()[0]
输出>>>
注意:\及/为正则表达式中特殊符号,需要转义才可用。
目测需要json和xml模块, json把数据转成json格式,然后从其中提取rawXML, 这段用xml模块解析