You can use any
:
a_string = "A string is more than its parts!"
matches = ["more", "wholesome", "milk"]
if any(x in a_string for x in matches):
Similarly to check if all the strings from the list are found, use all
instead of any
.
Related Contents:
- How to split a string of space separated numbers into integers?
- How to convert a string of bytes into an int?
- Python csv string to array
- How to create a numpy array of arbitrary length strings?
- Element-wise string concatenation in numpy
- How to parse a string and return a nested array?
- How can I interleave or create unique permutations of two strings (without recursion)
- Setting the fmt option in numpy.savetxt
- Why doesn’t calling a string method do anything unless its output is assigned?
- How to extract numbers from a string in Python?
- Split Strings into words with multiple word boundary delimiters
- Split string with multiple delimiters in Python [duplicate]
- How to get the value of a variable given its name in a string? [duplicate]
- How to test if a string contains one of the substrings in a list, in pandas?
- Sorting arrays in NumPy by column
- How to check for palindrome using Python logic
- Converting a string representation of a list into an actual list object [duplicate]
- How to sort a list of strings?
- Set partitions in Python
- How to check if a string in Python is in ASCII?
- TypeError: not all arguments converted during string formatting python
- How to apply a disc shaped mask to a NumPy array?
- Frequency counts for unique values in a NumPy array
- How to declare an array in Python?
- Convert floating point number to a certain precision, and then copy to string
- Python __str__ versus __unicode__
- How to match any string from a list of strings in regular expressions in python?
- Replace nth occurrence of substring in string
- subsampling every nth entry in a numpy array
- Split string using a newline delimiter with Python [duplicate]
- Find all upper, lower and mixed case combinations of a string
- What is the max length of a Python string?
- How can I convert each item in the list to string, for the purpose of joining them? [duplicate]
- How to replace two things at once in a string?
- Standard way to embed version into Python package?
- Get last “column” after .str.split() operation on column in pandas DataFrame
- Setting variables with exec inside a function
- Regex for existence of some words whose order doesn’t matter
- Ambiguity in Pandas Dataframe / Numpy Array “axis” definition
- str.startswith with a list of strings to test for
- How do I remove leading whitespace in Python?
- Left justify string values in a pandas DataFrame
- Perform a string operation for every element in a Python list
- How is unicode represented internally in Python?
- How to count digits, letters, spaces for a string in Python?
- How do I check if raw input is integer in python 2.7?
- Is there a native templating system for plain text files in Python?
- How to create a numpy array of lists?
- How to count values in a certain range in a Numpy array?
- How can I split a string of a mathematical expressions in python?