how to implement smart indent in python as done in Matlab
<p>Is there anyone who know some way to automate the correct indentation in coding in Python?
For example, when I write codes as follows:</p>

<pre><code>if condition1:
print a
else:
print b
</code></pre>

<p>Then the codes should be formatted as follows:</p>

<pre><code>if condition1:
    print a
else:
    print b*
</code></pre>

<p>I use Spyder for python programming. Thanks!</p>

<p>I am new to python and doing scientific computing.  I really like the <a href="https://www.jetbrains.com/pycharm/" rel="nofollow"> PyCharm IDE</a>.  I am using the free community version, and it works great for me.</p>

<p>In any case, I believe this is a function of the IDE.</p>

python indentation