I currently have this second part of this function to convert words in a string using a dictionary. What is the best way of doing this with a list rather than a dictionary?
def multipleReplace(text,function):
if function == 1:
if function == 2:
rc = re.compile(r"[A-Za-z_]\w*")
def translate(match):
word = match.group(0)
return wordDict.get(word, word)
return rc.sub(translate, text)
Thanks.