我有一个读取文件行的脚本..有些行包含错误消息..所以我做了一个循环(这里只是一行)来查找这些行并提取消息:
import re
data = "15:31:17 TPP E Line 'MESSAGE': There is a technical problem in the server."
if (re.findall(".*E Line.*",data)):
err = re.match(r'\'MESSAGE\':\s(*$)',data)
print err
执行此脚本时出现错误:/我希望它返回:
There is a technical problem in the server