title: Get broken data as a row in Python
body: <p>I have a txt file from where I am reading data line by line using file handling, something like this.</p>
  <pre><code>file = open(input_file,'r') #input file is the path of the file
  filelines = file.readlines()
  file.close()
  counter = 0
  
  complete_line = &quot;&quot;
  line_start = 
  for line in filelines:
      print(&quot;Line number counter {} and data is -- {}&quot;.format(counter,line))
      if counter &gt; 50:
         break
      counter += 1
  </code></pre>
  <p>Everything is working fine but there is one abnormality in data. When I print the line, they look like this:</p>
  <pre class="lang-none prettyprint-override"><code>FAR:A|4|2
  MIR:||FT4232HAQ_QFN64|J750_036-1|J750|10:43:10 13-Oct-2020|10:47:01 13-Oct-2020|
   prod||0|||||IG-XL|3.50.40 (P1402)
  SDR:1|0|0,1,2,3|||||||0|0
  PMR:1|3|0||VCC3IO|1|0
  PMR:1|3|4||VCC3IO|1|1
  PMR:1|3|12||VCC3IO|1|2
  </code></pre>
  <p>The abnormality is, Python is reading <code>prod||0|||||IG-XL|3.50.40 (P1402)</code> as a separate line but it is not correct. It has to go with the previous line <code>MIR:||FT4232HAQ_QFN64|J750_036-1|J750|10:43:10 13-Oct-2020|10:47:01 13-Oct-2020|</code>. This is the case with many other lines. Basically, it should be considered one line unless the line starts with PMR,SDR,MIR.. and some other prefix.</p>
  <p>As a workaround, I have replaced all the &quot;[space]\n&quot; with &quot;&quot; with the help of sublime text editor. But that doesn't work. It is still reading <code>prod||0|||||IG-XL|3.50.40 (P1402)</code> as a separate line.</p>
  <p>Is there any elegant way to do it with Python or programming in general?</p>