Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is the raw data
- blah1
- blah2 la la la
- blah3
- CIP3BeginFront <---- I want to take everything AFTER this
- this is
- cip data for
- the front
- CIP3EndFront <---- and BEFORE this, and set it aside as FrontData
- CIP3BeginBack <---- then take everything AFTER this
- and this is
- also cip data
- but for the back
- CIP3EndBack <---- and BEFORE this, and set it aside as FrontData
- endblah
- endblah2
- endblah3
- # End raw data
- I then need to put FrontData where BackData was, and vice versa.
- My plan for the program is this:
- open the sourcefile.txt
- create values, Front = False, Back = False
- while file is open:
- read every line
- if line is CIP3BeginFront set Front = True
- while Front = True, write line to FrontData.txt, delete line
- if line is CIP3EndFront set Front = False
- if line is CIP3BeginBack set Back = True
- while Back = True, write line to BackData.txt, delete line
- if line is CIP3EndFront set Back = False
- # reading is done because file ended
- read every line
- if line is CIP3BeginFront set Front = True
- while Front = True, insert BackData.txt after current line, set Front = False
- if line is CIP3BeginBack set Back = True
- while Back = True, insert FrontData.txt after current line, set Back = False
- write to sourcefile.txt
- delete FrontData.txt, BackData.txt
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement