"Spyros Charonis" <s.charo...@gmail.com> wrote
I have a file with the following contents:
from header1
abcdefghijkl
mnopqrs
tuvwxyz
*
from header2
poiuytrewq
lkjhgfdsa
mnbvcxz
*
My string processing code goes as follows:
file1=open('/myfolder/testfile.txt')
scan = file1.readlines()
string1 = ' '
for line in scan:
if line.startswith('>from'):
continue
if line.startswith('*'):
continue
string1.join(line.rstrip('\n'))
string1 = ''.join(scan[1:-1]).replace('\n','')
Does that do it?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor