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
.
More 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?
- How to parse a string and return a nested array?
- Element-wise string concatenation in numpy
- Byte Array to Hex String
- How can I interleave or create unique permutations of two strings (without recursion)
- Setting the fmt option in numpy.savetxt
- How can I slice each element of a numpy array of strings?
- Fast string array – Cython
- Convert a String representation of a Dictionary to a dictionary?
- How do I put a variable’s value inside a string?
- How to convert strings into integers?
- Using numpy to build an array of all combinations of two arrays
- Checking if a string can be converted to float in Python
- Check if string has date, any format
- Find nearest indices for one array against all values in another array – Python / NumPy
- Splitting on last delimiter in Python string?
- Convert a 1D array to a 2D array in numpy
- Why is True returned when checking if an empty string is in another?
- Replace first occurrence only of a string?
- “In” operator for numpy arrays?
- Remove final character from string
- How do I create a multiline Python string with inline variables?
- What does ‘u’ mean in a list?
- How to split a string within a list to create key-value pairs in Python
- Python: how to store a numpy multidimensional array in PyTables?
- numpy division with RuntimeWarning: invalid value encountered in double_scalars
- What is internal representation of string in Python 3.x