下邊內容是關于python判斷字符串(string)是否包含(contains)子字符串的方法的內容舍扰。
方法2:使用find函數實現contains的功能
s = "This be a string"
if s.find("is") == -1:
? ? print "No 'is' here!"
else:
? ? print "Found 'is' in the string."
下邊內容是關于python判斷字符串(string)是否包含(contains)子字符串的方法的內容舍扰。
方法2:使用find函數實現contains的功能
s = "This be a string"
if s.find("is") == -1:
? ? print "No 'is' here!"
else:
? ? print "Found 'is' in the string."