Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 printing set of lines between patterns
#1
I have a requirement were in i need to print the lines between 2 patterns into files 
The text in the below format is available in a file. The requirement is to create a new file for each "StartPattern" and write the lines after it into the file till the "EndPattern" is reached. The StartPattern names change but the EndPattern is a constant string.  I'm new to python so unable to get a complete program to do it

<StartPattern1>
line1
line2
line3
line4
<EndPattern>

<StartPattern2>
line1
line2
line3
<EndPattern>

....
....
....

Example Output
============

1. StartPattern1.txt
2. StartPattern2.txt
Quote
#2
(Dec-13-2016, 10:22 AM)pybegin Wrote:  I'm new to python so unable to get a complete program to do it
We will still need to see an attempt and hear what exact problem you are facing before we will be able (willing) to help you.
Quote
#3
I, personally, come here to help people learn python. Not to write code. I have a day job (...and projects I work on on the weekends/nights) for that. Give it a try, and a lot of us will gladly help you figure out what you can't. But we won't start/finish it for you.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to Find & Count String Patterns Between two Markers in a HTML file ahmedwaqas92 3 242 Aug-19-2019, 10:12 AM
Last Post: ahmedwaqas92
  Messenger Library for MVC-like Patterns CanadaGuy 2 616 Nov-05-2018, 04:46 PM
Last Post: CanadaGuy
  Printing lines in a basic text file Drone4four 6 840 Aug-16-2018, 03:10 PM
Last Post: snippsat
  printing a list of lines Skaperen 7 1,388 Jul-30-2017, 03:28 AM
Last Post: Skaperen
  NameError: name 'patterns' is not defined Debian 1 4,932 Apr-28-2017, 06:04 AM
Last Post: nilamo
  desired patterns nengkya 5 1,907 Apr-15-2017, 10:34 PM
Last Post: ichabod801

Forum Jump:


Users browsing this thread: 1 Guest(s)