I\'m trying to see if a string exists in another string with out using Python\'s predefined functions such as find and index..
Right now what my function takes 2 strings
You can do:
>>> haystack = "abcdefabc. asdli! ndsf acba saa abe?" >>> needle = "abc" >>> for i, _ in enumerate(haystack): ... if haystack[i:i + len(needle)] == needle: ... print (i) ... 0 6