我需要创建一个在python中使用的regexp,其中一个关键字将在输出中匹配&;应显示完全匹配的整条线路,请协助
Some_output = "hello how are you something. \nhello how are you2 something.\nhello how are you3
something."
Search_String ="you2"
Expected Output - how are you2 something.
vv = re.findall(r'.*you2.*',Some_output)
print(vv) - returns nothing
我会将您的输入标记化/拆分为一系列句子,然后使用列表理解来查找匹配的句子:
首先,将字符串转换为一个列表,然后查找与
Search_String
标记匹配的任何行相关问题 更多 >
编程相关推荐