Python Forum
a program i want: file line slicing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a program i want: file line slicing
#2
Skaperen Wrote:any suggestions?
I think it's a very good idea. I'm thinking about the itertools module with its dropwhile() and takewhile() methods and I imagine a DSL such as
Output:
take until line 10 drop 3 lines take until regex "foo(bar|qux)" drop until "begin" take until "end" take 1 line
Such a "program" would generate an iterable of lines to be sent to a new file. The DSL could manage several input files at the same time...
Reply


Messages In This Thread
a program i want: file line slicing - by Skaperen - Dec-16-2018, 05:10 AM
RE: a program i want: file line slicing - by Gribouillis - Dec-16-2018, 08:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  traceback reports "wrong" file and line Skaperen 5 2,989 Nov-21-2019, 07:15 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020