match only exact word/string in python
<p>How to match exact string/word while searching a list. I have tried, but its not correct. below I have given the sample list, my code and the test results</p>

<pre><code>list = ['Hi, friend', 'can you help me?']
</code></pre>

<p>my code</p>

<pre><code>dic=dict()
for item in list:
    for word in item.split():
        dic.setdefault(word, list()).append(item)

print dic.get(s)
</code></pre>

<p>test results:</p>

<pre><code>s = "can" ~ expected output: 'can you help me?' ~ output I get: 'can you help me?'
s = "you" ~ expected output: *nothing* ~ output I get: 'can you help me?'
s = "Hi," ~ expected output: 'Hi, friend' ~ output I get: 'Hi, friend'
s = "friend" ~ expected output: *nothing* ~ output I get: 'Hi, friend'
</code></pre>

<p>My list contains 1500 strings. Anybody can help me??</p>
