Python 判断列表中是否有元素被另一字符串包含
推荐阅读
正文
python
lst = ['das', 'it']
str1 = 'dasAuto'
if any(text in str1 for text in lst):
print('The string contains at least one element from the list')
else:
print('The string does NOT contain any of the elements in the list')
"""
result:
The string contains at least one element from the list
"""
如果大家觉得有用,就请点个赞吧~