ใช้ any() ร่วมกับ generator expression
ตัวอย่าง
arr = ['a', 'e', 'i', 'o', 'u']
str = "hello people"
if any(c in str for c in arr):
print("Found a match")
ผลลัพธ์
Found a match
วิธี Regex (overkill แต่ได้ผล)
import re
arr = ['a', 'e', 'i', 'o', 'u']
str = "hello people"
if any(re.findall('|'.join(arr), str)):
print('Found a match')