Advertisement
vaboro

ps3d.py

May 26th, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. def subStringMatchExactlyOneSub(target,key):
  2.    
  3.     exactMatch = list(subStringMatchExact(target,key))
  4.     constrainedMatchOneSub = list(subStringMatchOneSub(key, target))
  5.  
  6.     # Now I have to compare each element of exactMatch list to each element of constrainedMatchOneSub list.
  7.     # The goal is to drop own all elements of constrainedMatchOneSub list that are equal to elements of
  8.     # exactMatch list
  9.  
  10.     # this is the idex of constrainedMatchOneSub list
  11.  
  12.     i = 0
  13.  
  14.     # the length of constrainedMatchOneSub list decreases as elements are removed
  15.  
  16.     for j in range(len(exactMatch)):
  17.         while i < len(constrainedMatchOneSub):
  18.             if exactMatch[j] == constrainedMatchOneSub[i]:
  19.                 constrainedMatchOneSub.pop(i)
  20.             else:
  21.                 i += 1
  22.         i = 0
  23.     constrainedMatchOneSubTuple = tuple(constrainedMatchOneSub)
  24.     return constrainedMatchOneSubTuple
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement