title: IndexError in Python while splitting an input file based on a pattern
body: <p>The code tries to split the text data based on a separator but I keep getting an error</p>
  <pre><code>Traceback (most recent call last):
    File &quot;split.py&quot;, line 7, in &lt;module&gt;
      en_text = split_text[1].lstrip()
  IndexError: list index out of range
  </code></pre>
  <p>And the output of the two files has to be the same number of lines but I got <code>94132 en_out.txt</code> and <code>94304 mn_out.txt</code> for two of the files which im not sure what's going on.</p>
  <p>The code I used is</p>
  <pre><code>with open('mn_en_sentences_split.txtaa') as inputFile:
      inFile = inputFile.readlines()
  
  for i in inFile:
      split_text = i.split(&quot;+++++SEP+++++&quot;)
      mn_text = split_text[0].rstrip()
      en_text = split_text[1].lstrip()
      with open(&quot;mn_out.txt&quot;, &quot;a&quot;) as mn_out:
          mn_out.write(mn_text + &quot;\n&quot;)
      
      with open(&quot;en_out.txt&quot;, &quot;a&quot;) as en_out:
          en_out.write(en_text)
  </code></pre>
  <p>The input file for this code can be found here at <a href="https://drive.google.com/file/d/1GNo1XJxRFxjey5VDsHjLvj9upXJOqd3e/view" rel="nofollow noreferrer">https://drive.google.com/file/d/1GNo1XJxRFxjey5VDsHjLvj9upXJOqd3e/view</a></p>