【发布时间】:2019-02-04 02:23:14
【问题描述】:
我有一个名为keywords的字符串列表:
keywords = ["123", "hello there"]
我想看看这些字符串是否在此列表中strArr:
strArr = ["123", "hello there", "another"]
我试过了:
if all (keyword in strArr for keyword in keywords):
print("True")
else:
print("False")
如果我有完整的字符串,它会工作并返回 true,但是当我尝试找到这样的子字符串时会失败:
keywords = ["123", "hello"]
【问题讨论】:
标签: python string list csv substring