Splitting string in python when last part may not exist
<p>How do I split the foll. in python:</p>

<pre><code>'a_b_c'
</code></pre>

<p>The appraoch should also work if string is <code>'a_b'</code></p>

<pre><code>splited = "a_b_c".split('_')
</code></pre>

<p><code>inputstring.split('_')</code> will split it.</p>

python