title: Split a string if character is present else don't split
body: <p>I have a <code>string</code> like below in <code>python</code></p>
  <pre><code>testing_abc
  </code></pre>
  <p>I want to split string based on <code>_</code> and extract the <code>2</code> element</p>
  <p>I have done like below</p>
  <pre><code>split_string = string.split('_')[1]
  </code></pre>
  <p>I am getting the correct output as expected</p>
  <pre><code>abc
  </code></pre>
  <p>Now I want this to work for below strings</p>
  <pre><code>1) xyz
  </code></pre>
  <p>When I use</p>
  <pre><code>split_string = string.split('_')[1]
  </code></pre>
  <p>I get below error</p>
  <pre><code>list index out of range
  </code></pre>
  <p>expected output I want is <code>xyz</code></p>
  <pre><code>2) testing_abc_bbc
  </code></pre>
  <p>When I use</p>
  <pre><code>split_string = string.split('_')[1]
  </code></pre>
  <p>I get <code>abc</code> as output</p>
  <p>expected output I want is <code>abc_bbc</code></p>
  <p>Basically What I want is</p>
  <pre><code>1) If string contains `_` then print everything after the first `_` as variable
  2) If string doesn't contain `_` then print the string as variable
  </code></pre>
  <p>How can I achieve what I want</p>