Python detect character surrounded by spaces
<p>Anyone know how I can find the character in the center that is surrounded by spaces?</p>

<p><code>1 + 1</code></p>

<p>I'd like to be able to separate the <code>+</code> in the middle to use in a if/else statement.</p>

<p>Sorry if I'm not too clear, I'm a Python beginner.</p>

<p>I think you are looking for something like the <code>split()</code> method which will split on white space by default.</p>

<p>Suppose we have a string <code>s</code></p>

<pre><code>s = "1 + 1"
chunks = s.split()
print(chunks[1]) # Will print '+'
</code></pre>

python python-3.x