Searching Strings for Substrings : find « String « Python Tutorial






searchStr =  "Red Blue Violet Green Blue Yellow Black"

print searchStr.find("Red")
print searchStr.find("Blue")
print searchStr.find("Teal")








5.9.find
5.9.1.The find method finds a substring within a larger string.
5.9.2.find from an index
5.9.3.Searching Strings for Substrings