<div>I have a file with the following contents: </div><div><br></div><div><div>&gt;from header1</div><div>abcdefghijkl</div><div>mnopqrs</div><div>tuvwxyz</div><div>*</div><div>&gt;from header2 </div><div>poiuytrewq</div><div>
lkjhgfdsa</div><div>mnbvcxz</div><div>*</div></div><div><br></div><div>My string processing code goes as follows: </div><div><br></div><div>file1=open(&#39;/myfolder/testfile.txt&#39;)</div><div>scan = file1.readlines()</div>
<div><br></div><div>string1 = &#39; &#39;</div><div>for line in scan:</div><div>    if line.startswith(&#39;&gt;from&#39;):</div><div>        continue</div><div>    if line.startswith(&#39;*&#39;):</div><div>        continue</div>
<div>    string1.join(line.rstrip(&#39;\n&#39;))</div><div><br></div><div>This code produces the following output:</div><div><br></div><div><div>&#39;abcdefghijkl&#39;</div><div>&#39;mnopqrs&#39;</div><div>&#39;tuvwxyz&#39;</div>
<div>&#39;poiuytrewq&#39;</div><div>&#39;lkjhgfdsa&#39;</div><div>&#39;mnbvcxz&#39;</div></div><div><br></div><div>I would like to know if there is a way to get the following </div><div>output instead: <br><br></div><div>
<meta charset="utf-8"><div>&#39;abcdefghijklmnopqrstuvwxyz&#39;</div></div><div><br></div><div><meta charset="utf-8"><div>&#39;poiuytrewqlkjhgfdsamnbvcxz&#39;</div></div><div><br></div><div>I&#39;m basically trying to concatenate the strings </div>
<div>in order to produce 2 separate lines </div><div><br></div><div><br></div>