samedi 5 juillet 2014

Need to save specific text from text file into a new text file/ python


Vote count:

0




I have some text which follows the following pattern:




HEADING

Several lines of text


until a blank line




What I'd like to do is loop through the text file until I get to the Heading I am interested in (it occurs several times in the file - but there are also headings that I am not interested in taking the text from) and select the several lines of text which then follow below the heading text.


As I go through the text file I'd like to keep collating all lines that were to do with that specific heading. Ideally they can stay in individual lines - in a new text document.


I'd appreciate your help with this!



asked 51 secs ago






Aucun commentaire:

Enregistrer un commentaire