How to frame two for loops in list comprehension python

后端 未结 6 2129
予麋鹿
予麋鹿 2020-11-28 20:06

I have two lists as below

tags = [u\'man\', u\'you\', u\'are\', u\'awesome\']
entries = [[u\'man\', u\'thats\'],[ u\'right\',u\'awesome\']]

6条回答
  •  野性不改
    2020-11-28 20:12

    This should do it:

    [entry for tag in tags for entry in entries if tag in entry]
    

提交回复
热议问题