"Spyros Charonis" <s.charo...@gmail.com> wrote

for item in finalmotifs:
   for line in my_list:
       if item in line:
           print line.index(item)

But this only returns a single number (e.g 119), which is the index at which
my sequence begins.

Is it possible to get a pair of indices that indicate beginning and end of
substring?


print line.index(item)+len(item)

Presumably since its matching item the end index will be len(item)
characters later? Or am I missing something?

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to