 <p>I guess the <code>word_list</code>(try to rename the variable to <code>word_dict</code>, I think that is more appropriate) has lots of items, </p> <pre><code>for index, data in enumerate(sentence): for key, value in word_list.iteritems(): if key in data: sentence[index]=data.replace(key, word_list[key]) </code></pre> <p>working example from <code>ipython</code></p> <pre><code>In [1]: word_list = { "hello" : "1", "bye" : "2"} In [2]: sentence = ['hello you, hows things', 'hello, good thanks'] In [3]: for index, data in enumerate(sentence): ...: for key, value in word_list.iteritems(): ...: if key in data: ...: sentence[index]=data.replace(key, word_list[key]) ...: In [4]: sentence Out[4]: ['1 you, hows things', '1, good thanks'] </code></pre>