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 would recommend getting <a href="https://atom.io/" rel="nofollow">ATOM</a> it is a great text editor for python. By the way have you tried saving your source file as something.py before you gone ahead and started type in your code? it might be the reason.</p>

python indentation