Uma implementação muito ineficiente usando força bruta:
def sub_string(pattern, text):
n = len(text);
m = len(pattern);
for i in range(0,n-m+1):
j=0
while((j<m) and (text[i+j]==pattern[j])):
j=j+1
if (j == m):
return i;
return -1;
if __name__ == '__main__':
pattern='nice'
text='Professor Cajueiro is a very nice guy'
print sub_string(pattern, text)