字串包含在列表中的方式:
檢查字串d是否存在列表中: wordlist = ["a","b","cde"]
word = "d"
for str in wordlist:
if word in str:
print(str + " contains: " + word)
|
執行結果: cde contains: d |
全站熱搜
字串包含在列表中的方式:
檢查字串d是否存在列表中: wordlist = ["a","b","cde"]
word = "d"
for str in wordlist:
if word in str:
print(str + " contains: " + word)
|
執行結果: cde contains: d |
留言列表