比较句子列表和单词列表,如果单词出现,返回完整的句子

2024-09-28 01:23:49 发布

您现在位置:Python中文网/ 问答频道 /正文

从句子列表和单词列表中,如果有单词,如何返回完整的句子列表。请建议。下面是示例列表

listwords = ['people',  'Covid-19',  'Lockdowns', 'Maximum' ]

listsent = ['The number of people suffering acute hunger could almost double.',
        'It is potentially catastrophic for millions',
        'Lockdowns and global economic recession have',
        'one more shock – like Covid-19 – to push them over the edge',
        'people must collectively act now to mitigate the impact']

“人”出现在两句话中,“新冠病毒-19”出现在一句话中,“锁定”出现在一句话中。 输出列表应包含listsent中匹配的四个完整句子。


Tags: theto示例number列表people单词建议

热门问题