<div>I have a file with the following contents: </div><div><br></div><div><div>>from header1</div><div>abcdefghijkl</div><div>mnopqrs</div><div>tuvwxyz</div><div>*</div><div>>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('/myfolder/testfile.txt')</div><div>scan = file1.readlines()</div>
<div><br></div><div>string1 = ' '</div><div>for line in scan:</div><div> if line.startswith('>from'):</div><div> continue</div><div> if line.startswith('*'):</div><div> continue</div>
<div> string1.join(line.rstrip('\n'))</div><div><br></div><div>This code produces the following output:</div><div><br></div><div><div>'abcdefghijkl'</div><div>'mnopqrs'</div><div>'tuvwxyz'</div>
<div>'poiuytrewq'</div><div>'lkjhgfdsa'</div><div>'mnbvcxz'</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>'abcdefghijklmnopqrstuvwxyz'</div></div><div><br></div><div><meta charset="utf-8"><div>'poiuytrewqlkjhgfdsamnbvcxz'</div></div><div><br></div><div>I'm basically trying to concatenate the strings </div>
<div>in order to produce 2 separate lines </div><div><br></div><div><br></div>