[Solved] Find a specific word from a list in python


First off, do not use the name list for assignment to your objects, you’ll shadow the builtin list type.

Then, you can use a list comprehension with str.startswith in a filter:

new_lst = [x for x in lst if x.startswith('backend')]

0

solved Find a specific word from a list in python