在这篇文章中,我们将学习如何在 Python 中检查字符串是否包含列表中的元素。使用的方法嵌套 For 循环列表推导式使用 any() 函数使用 find() 函数示例假设我们已经获取了一个输入字符串和一个输入列表。我们现在将检查输入字符串是否至少包含任何一个输入列表元素。输入inputString = "tutorialspoint is a best learning platform for coding" inputList = ['hello', 'tutorialspoint', 'python']输出YES,字符串包含输入列表中的元素在上面的示例中,... 阅读更多