1greeting = ['hello','my','name','is','bob','how','are','you','my','name','is']
2
3def find_sub_list(sl,l):
4 results=[]
5 sll=len(sl)
6 for ind in (i for i,e in enumerate(l) if e==sl[0]):
7 if l[ind:ind+sll]==sl:
8 results.append((ind,ind+sll-1))
9
10 return results
11
12print find_sub_list(['my','name','is'], greeting)
13# [(1, 3), (8, 10)]
14