You have several options, but most obvious are:

Using list comprehension with a condition:

result = [i for i in some_list if i.startswith('GFS01_')]

Using filter (which returns iterator)

result = filter(lambda x: x.startswith('GFS01_'), some_list)
Answer from temasso on Stack Overflow
Discussions

How to check if a string contains an element from a list in Python - Stack Overflow
I just wish there was something like "contains" rather than just startswith or endswith 2017-02-09T23:34:33.69Z+00:00 ... @ShekharSamanta sure, but that doesn’t solve the problem of checking if one of multiple things is in a string, which is that the original question was about. 2018-05-03T19:14:10.153Z+00:00 ... Yes in that case we can use : if any(element in string.split('any delmiter') for element in list... More on stackoverflow.com
🌐 stackoverflow.com
How to check if any element in a list contains a substring
If you don't need to know exactly which element(s) contain the substring, then you could use the any built-in function in combination with a list comprehension l = ["Hey dude", "Hey bro", "Sup dude", "Hey bud"] substring = "Sup" if any([substring in element for element in l]): print(f"One or more elements of {l} contain the substring {substring}") else: print(f"No elements of {l} contain the substring {substring}") Here's an explanation about the any function. Alternatively, switch out any for all if you want to check if all the elements of the list contain the substring. all documentation More on reddit.com
🌐 r/learnpython
18
11
October 28, 2019
python - str.startswith with a list of strings to test for - Stack Overflow
Unfriendly or contains harassment/bigotry/abuse. This comment is unkind, insulting or attacks another person or group. Learn more in our Abusive behavior policy. Not needed. This comment is not relevant to the post. ... Something else. A problem not listed above. More on stackoverflow.com
🌐 stackoverflow.com
python - Get a list of names which start with certain letters - Stack Overflow
I need to implement a function that takes as a parameter a list of names(strings) and another parameter that takes a list of characters. The function should print out the names in the first list that More on stackoverflow.com
🌐 stackoverflow.com
🌐
datagy
datagy.io › home › python posts › python strings › python string startswith: check if string starts with substring
Python String startswith: Check if String Starts With Substring • datagy
December 16, 2022 - Then, we can use the .startswith() method to check if a string starts with a pattern using case insensitivity. In this section, you’ll learn how to use the Python .startswith() method to check if items in a list of strings start with a substring.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-check-if-string-starts-with-any-element-in-list
Check if String starts with any Element from List in Python | bobbyhadz
Use the str.startswith() method to check if each item starts with the string. The new list will only contain the items that meet the condition.
🌐
GeeksforGeeks
geeksforgeeks.org › python-check-if-string-starts-with-any-element-in-list
Python - Check if string starts with any element in list - GeeksforGeeks
January 16, 2025 - Let's explore some more methods and see how we can check if string starts with any element in list. ... We can use the any() function to combine the startswith() check for all elements in the list into a single line. ... s = "geeksforgeeks" prefixes = ["geek", "for", "python"] # Using any to check for prefixes res = any(s.startswith(prefix) for prefix in prefixes) print(res)
🌐
PyTutorial
pytutorial.com › python-check-if-string-starts-with-any-prefix-of-a-list
PyTutorial | Python Check String Starts with List of Prefixes
April 22, 2026 - # Method 1: Convert list to tuple for startswith() prefixes = ["http://", "https://", "ftp://"] url = "https://www.example.com" # Convert list to tuple if url.startswith(tuple(prefixes)): print("URL uses a valid web protocol.") else: print("Invalid or unknown protocol.") Output: URL uses a valid web protocol. This is the most efficient and Pythonic way. It's clean and uses built-in functionality. You can also use a simple loop. Iterate through each prefix in the list. Check the string against each one.
🌐
Programiz
programiz.com › python-programming › methods › string › startswith
Python String startswith()
Online Python Online JavaScript ... Online Go Online Rust Online Scala Online Dart Online R Online Ruby ... The startswith() method returns True if a string starts with the specified prefix(string)....
🌐
W3Schools
w3schools.com › python › ref_string_startswith.asp
Python String startswith() Method
Remove List Duplicates Reverse ... Python Interview Q&A Python Training ... The startswith() method returns True if the string starts with the specified value, otherwise False....
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-find-string-in-list
Python Find String in List: Methods and Examples | DigitalOcean
Learn how to find a string in a Python list using in, index(), list comprehension, and regex. See practical, runnable code examples and start today.
🌐
GeeksforGeeks
geeksforgeeks.org › python-test-if-string-contains-element-from-list
Python - Test if string contains element from list - GeeksforGeeks
January 8, 2025 - Let's discuss different methods to solve this problem.Using startswith() with tuplestartswith() method in Python can accept a tuple of strings to check if the string starts with any of them.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-find-the-string-in-a-list
Python program to find String in a List - GeeksforGeeks
July 23, 2025 - a = ['Learn', 'Python', 'With', 'GFG'] found = False for item in a: if item == 'Python': found = True break if found: print("String found!") else: print("String not found!") ... String found! The for loop iterates through the list and checks each element against the target string. While slower than the in operator, it gives us a greater control over the process. List comprehensions allow us to create a new list containing matching elements.
🌐
Reddit
reddit.com › r/learnpython › how to check if any element in a list contains a substring
r/learnpython on Reddit: How to check if any element in a list contains a substring
October 28, 2019 -

Say I have a list of strings like: ["Hey dude", "Hey bro", "Sup dude", "Hey bud"]

How do I check if *any* of those strings in the list contain the word "Sup"?Alternatively, in my case, I could also check if *all* of the strings contain "Hey" , which I also don't know how to do.

(Sorry, I'm new to Python)

Edit: Thank you so much for all the help, guys <3

🌐
Stack Overflow
stackoverflow.com › questions › 10134372 › get-a-list-of-names-which-start-with-certain-letters
python - Get a list of names which start with certain letters - Stack Overflow
I need to implement a function that takes as a parameter a list of names(strings) and another parameter that takes a list of characters. The function should print out the names in the first list that
🌐
Delft Stack
delftstack.com › home › howto › python › python list contains string
How to Check if List Contains a String in Python | Delft Stack
February 2, 2024 - We can also use list comprehension to find out strings containing multiple specific values i.e., we can find strings containing a and b in py_list by combining the two comprehensions. ... py_list = ["a-1", "b-2", "c-3", "a-4", "b-8"] q = ["a", "b"] r = [s for s in py_list if any(xs in s for xs in q)] print(r) ... The filter() function filters the given iterable with the help of a function that checks whether each element satisfies some condition or not.
🌐
LabEx
labex.io › tutorials › python-how-to-check-if-a-list-contains-a-string-in-python-559525
How to Check If a List Contains a String in Python | LabEx
In this step, you will learn how to use the any() function in combination with the isinstance() function to check if any element in a list is an instance of a specific data type, such as a string.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-find-the-list-elements-starting-with-specific-letter
Find the List elements starting with specific letter - Python - GeeksforGeeks
July 11, 2025 - Explanation: filter() with a lambda filters names in a where the first character, converted to lowercase, matches the lowercase version of b. The result is an iterator, which is then converted to a list and stored in res. startswith() method check if a name begins with a given prefix, converting both strings to lowercase to make it case-insensitive.