【发布时间】:2021-05-31 09:17:31
【问题描述】:
我有一个字符串列表,现在我想提取包含特定关键字(包括这两个字符串)的两个字符串之间的所有字符串。
example_list = ['test sentence', 'the sky is blue', 'it is raining outside', 'mic check', 'vacation time']
keywords = ['sky', 'check']
我想要达到的结果:
result = ['the sky is blue', 'it is raining outside', 'mic check']
到目前为止,我自己无法弄清楚。 也许可以使用两个循环并使用正则表达式?
【问题讨论】:
标签: python string list substring sublist