Hello, I am trying to find the best way to do this. My goal is to only call this subroutine only ONCE, and the logic is contingent upon two outputs.
lWords=[...] # List of many, many words lData=[...] #list of some words that need to be validated against lWords #subroutine to search for words, ignore case def sub1(foo): pFoo=re.compile(foo,re.I) for word in lWords: if re.search(pFoo,word): return[1,word] #logic loop for word in lData: if word in lWords: continue elif sub1(word)[0]=1: word=sub1(word)[1] # <--- Here is my question. else: print word " not found.\n" The subroutine is being run once at the elif statement. I don't want to run it again just to get the [1] value. *Is there any way to capture all of the values returned when it is run during the elif statement? *Is this actually running twice?
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor