How to Find String in Array Using Python

Itacen Sabacok | Aug 30, 2022
 1strArr = ['coding', 'like', 'an', 'insane']
 2find = "insane"
 3
 4for s in strArr:
 5  if find in s:
 6    print('its found!')
 7
 8# you can just run below command to find all matches in single line
 9matches = [match for match in strArr if find in match]
10print(matches)

OUTPUT:

its found!