How to check if a substring of a string is present in a list of strings with Python

1 Answer

0 votes
lst = ['python programming', 'java object-oriented', 'c computer programming language']

string = 'python programming totorial'

print(any(sub in string for sub in lst))




'''
run:

True

'''

 



answered Mar 22, 2023 by avibootz
...