【发布时间】:2021-10-12 15:12:23
【问题描述】:
我尝试在引号“”中提取文本
file content:
"abc"
"ABC. XYZ"
"1 - 2 - 3"
我尝试过使用正则表达式的代码
title = re.findall(r'\"(.+?)\"', filecontent)
print(title)
输出:
['abc']
[] # Some lines comes out like this empty
['1 - 2 - 3']
有些行是空的,不知道为什么。有没有其他更好的方法来做到这一点?
【问题讨论】:
-
好的,但是为什么呢?