Hi guys,
I have to read a file in (python) which looks like the following:
sequence: 1
cght ghgjt
sequence: 2
dsjhgfk kjhfds;kuhur
sequence: 3
ccccccccccccchhhhh
gggggggggggtt
sequence: 4
ffghjhjj
sequence: 5
sequence: 6
And i have to grab all the data into one line (see below). Basically 'sequence:' is my identifier that the next lines contain some information (or may none), but either way it has some information or not I need to make it into one line. Those lines that have nothing after 'sequence:' may be assign something like "none sequence" . How would you do this in Python? desired output:
sequence: 1 cght ghgjt
sequence: 2 dsjhgfk kjhfds;kuhur
sequence: 3 ccccccccccccchhhhh gggggggggggtt
sequence: 4 ffghjhjj
sequence: 5 "None sequence"
sequence: 6 "None sequence"
thank you,
what have you tried ?
good point Pierre, I forgot to share with my achievements.
so far I manage:
gives:
However the info of sequence 4 is missing and empty lines !!!!