擅长:python、mysql、java
<p>在线上进行拆分,并检查拆分部分中是否存在“Golden\u Image”字符串。你知道吗</p>
<pre><code>import re
with open("outlog.out") as f:
for line in f:
if not "Golden_Image" in i:
continue
print re.search(r'\S*Golden_Image\S*', line).group()
</code></pre>
<p>或者</p>
<pre><code>images = re.findall(r'\S*Golden_Image\S*', open("outlog.out").read())
</code></pre>
<p>示例:</p>
<pre><code>>>> s = '''
-#- --length-- -----date/time------ path
3 97103164 Feb 7 2016 01:36:16 +05:30 taas/NN41_R11_Golden_Image
4 1896 Sep 27 2019 14:22:08 +05:30 taas/NN41_R11_Golden_Config
5 1876 Nov 27 2017 20:07:50 +05:30 taas/nfast_default.cfg'''.splitlines()
>>> for line in s:
for i in line.split():
if "Golden_Image" in i:
print i
taas/NN41_R11_Golden_Image
>>>
</code></pre>