📌  相关文章
📜  从列表中选择与子字符串匹配的元素 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:14.369000             🧑  作者: Mango

代码示例1
mylist = ['abc123', 'def456', 'ghi789']
sub = 'abc'
next((s for s in mylist if sub in s), None) # returns 'abc123'