求教python大牛一个取字符串的问题
原始文本信息:
Receive:..........
....无关信息....
Receive:..........
....无关信息....
Receive:..........
....无关信息....
然后我的python脚本语言用msg.get("Receive")只能取到第一个receive,如何能取到3个recevie呢?
[解决办法]
import remsg = """Receive:aaaaaaaaaaaaaReceivemsg1aaaaaaaaaaaaaReceive:bbbbbbbbbbbbbReceivemsg2bbbbbbbbbbbbReceive:cccccccccccccReceivemsg3ccccccccccc"""patt = r'Receive:\w+\n(\w+)'rs = re.findall(patt, msg)print rs