从句子列表和单词列表中,如果有单词,如何返回完整的句子列表。请建议。下面是示例列表
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中匹配的四个完整句子。
列表理解是实现这一点的快速方法:
相关问题 更多 >
编程相关推荐