String = "Alienshave just discovered a way to open cans"
Arr=["Aliens","bird","cactus","John Cena"]
if any(words in String for words in arr):
print String
此脚本显示Alienshave just discovered a way to open cans
但是我不想它变成print
String
,因为String
中的Alienshave
和Arr
中的Aliens
不完全一样
如何做到这一点,以便比较的基础是数组中的字符串,而不是通配符
我使用
String.split()
将字符串拆分为单词使用带单词边界的正则表达式(
\b
):相关问题 更多 >
编程相关推荐