[ create a new paste ] login | about

Link: http://codepad.org/JKC5w5aZ    [ raw code | output | fork ]

Python, pasted on Jan 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from string import *

def subStringMatchExact(target, key):
    x = 0
    z = []
    for y in range(len(key)):
        findit = find(target, key[y],x)
        while findit != -1:
            z.append(findit)
            x = findit+1
            findit = find(target, key[y],x)
    return tuple(z)
        

print subStringMatchExact("SUCCESS","SU")


Output:
1
(0, 5, 6)


Create a new paste based on this one


Comments: