Python check if string got a certain word (or combination of characters)
<p>Ok so I have this string (for example):</p>

<pre><code>var = "I eat breakfast."
</code></pre>

<p>What i would like to do is to check if that string has the letters "ea", and I wanted to be able to put those values into a list.</p>

<p>I tried using var[x] but I can only have one character at the same time and not a word right?</p>

<p>Simple:</p>

<pre><code>&gt;&gt;&gt; var = "I eat breakfast."
&gt;&gt;&gt; 'ea' in var
True
</code></pre>

<p>I'm not clear what you mean by "put those values into a list." I assume you mean the words:</p>

<pre><code>&gt;&gt;&gt; [w for w in var.split() if 'ea' in w]
['eat', 'breakfast.']
</code></pre>

python python-3.x