下邊內容是關於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."
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。