testing for exact match of key strings in target strings. output must be tuple of starting points of matches. My code works but i feel like it can be much much neater. How could i return a tuple without converting from an appended list? searched everywhere and can't seem to find an answer. Thanks!!
from string import *
target1 = 'atgacatgcacaagtatgcat'
target2 = 'atgaatgcatggatgtaaatgcag'
key10 = 'a'
key11 = 'atg'
key12 = 'atgc'
key13 = 'atgca'
def subStringMatchExact(target, key):
match_list = []
location = 0
for i in target:
ans = find(target, key, location)
if ans >= 0:
match_list.append(ans)
location = ans + (len(key))
print tuple(match_list)
subStringMatchExact(target1, key11)