这些是文件的内容:-
org.mule.api.processor.LoggerMessageProcessor: Process Started MessageID=1AMULE
One
Two
Three
org.mule.api.processor.LoggerMessageProcessor: Process Completd MessageID=1AMULE
org.mule.api.processor.LoggerMessageProcessor: Process Started MessageID=2BMULE
org.mule.api.processor.LoggerMessageProcessor: Process Completd MessageID=2BMULE
我在这里要提取字符串1A,1B
,即在python中的org.mule.api.processor.LoggerMessageProcessor: Process Started MessageID=
之后和MULE
之前。
答案 0 :(得分:0)
您可以在str.split
上使用"="
例如:
with open(filename) as infile:
for line in infile:
if "=" in line:
print(line.split("=")[1].strip())
输出:
1AMULE
1AMULE
2BMULE
2BMULE