python判断字符串(string)是否包含(contains)子字符串的方法的代码

下边内容是关于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."




猜你喜欢

转载自www.cnblogs.com/bamboo9494/p/11445140.html