def countSubStringMatchRecursive(target, key, x): x = find(target, key, x) if x == -1: return 0 else: return countSubStringMatchRecursive(target, key, x+1) +1 target = ["atgacatgcacaagtatgcat", "atgaatgcatggatgtaaatgcag"] key = ["a", "atg", "atgc", "atgca"] for t in target: for k in key: print "There were " + str(countSubStringMatchRecursive(t, k, 0)) + " occurances of your key " + k + " in " + t |
target = ["atgacatgcacaagtatgcat", "atgaatgcatggatgtaaatgcag"] key = ["a", "atg", "atgc", "atgca"] for t in target: for k in key: print t + " " + k |
atgacatgcacaagtatgcat a atgacatgcacaagtatgcat atg atgacatgcacaagtatgcat atgc atgacatgcacaagtatgcat atgca atgaatgcatggatgtaaatgcag a atgaatgcatggatgtaaatgcag atg atgaatgcatggatgtaaatgcag atgc atgaatgcatggatgtaaatgcag atgca |