Analyzing the code python string (string) is included (the contains) a method substring

Content is below about python content determination string (string) is included (the contains) the method substring.

 







Method 2: Use the find function contains functions implemented


s = "This be a string"
if s.find("is") == -1:
print "No 'is' here!"
else:
print "Found 'is' in the string."




 

Guess you like

Origin www.cnblogs.com/bamboo9494/p/11445140.html