如何将re.findall应用于提供empyt列表的文件

cda*_*dac 5 python regex list

我在下面有文本文件:

Is there any way to do removing the empty list while using re.findall

Started : Sunday, May 1, 2016 1:59:16 PM
Source : C:\RegularExpressionsWithDotNet\robocopytest\source\?????\??????\English
Dest : C:\RegularExpressionsWithDotNet\robocopytest\destn\
Started : Sunday, May 1, 2016 1:59:16 PM
Source : C:\RegularExpressionsWithDotNet\robocopytest\source\?????\??????\English
Dest : C:\RegularExpressionsWithDotNet\robocopytest\destn\
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

with open(r'C:\debug.log', 'r', encoding='utf-8') as fr:
    eachline = fr.read()
data = [eachline.strip() for eachline in eachline.splitlines()]
datalinelist = []
for i in data:
    datalinelist.append(re.findall(r'\bSource : (.+)', i))
datalinelist
Run Code Online (Sandbox Code Playgroud)

我的出门是 [[], ['C:\\RegularExpressionsWithDotNet\\robocopytest\\source\\?????\\??????\\English'], [], [], ['C:\\RegularExpressionsWithDotNet\\robocopytest\\source\\?????\\??????\\English'], []]

有什么办法可以在使用re.findall时删除空列表

如果我在做 [line for line in open(file,'r',encoding='utf-8') if re.findall(r'Source : .+',line)]

我得到适当的锻炼 ['Source : C:\\RegularExpressionsWithDotNet\\robocopytest\\source\\?????\\??????\\English\n', 'Source : C:\\RegularExpressionsWithDotNet\\robocopytest\\source\\?????\\??????\\English\n']

处理with条件有什么错误