RE: Parsing multiple lines from text file using regex

2013-11-03 Thread Marc
>This is an alternative solution someone else posted on this list for a > similar problem I had: >#!/usr/bin/python3 >from itertools import groupby >def get_lines_from_file(file_name): >with open(file_name) as reader: >for line in reader.read

Re: Parsing multiple lines from text file using regex

2013-11-03 Thread Jason Friedman
> Hi, > I am having an issue with something that would seem to have an easy > solution, but which escapes me. I have configuration files that I would > like to parse. The data I am having issue with is a multi-line attribute > that has the following structure: > > banner > Banner text > Banner

RE: Parsing multiple lines from text file using regex

2013-10-28 Thread Marc
>Hi Marc, did you actually subscribe to the tutor list or did you just >send an email there? Peter replied to you and you can see the reply >here: >https://mail.python.org/pipermail/tutor/2013-October/098156.html > >He only sent the reply back to the tutor list and didn't email it >directly to you

RE: Parsing multiple lines from text file using regex

2013-10-28 Thread Marc
>Hi Marc, did you actually subscribe to the tutor list or did you just >send an email there? Peter replied to you and you can see the reply >here: >https://mail.python.org/pipermail/tutor/2013-October/098156.html > >He only sent the reply back to the tutor list and didn't email it >directly to you

Re: Parsing multiple lines from text file using regex

2013-10-28 Thread Oscar Benjamin
On 28 October 2013 00:35, Marc wrote: >>What was wrong with the answer Peter Otten gave you earlier today on the >>tutor mailing list? >> >>-- >>Python is the second best programming language in the world. >>But the best has yet to be invented. Christian Tismer >> >>Mark Lawrence >> > > > I did n

Re: Parsing multiple lines from text file using regex

2013-10-27 Thread Mark Lawrence
On 28/10/2013 00:35, Marc wrote: What was wrong with the answer Peter Otten gave you earlier today on the tutor mailing list? -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence I did not receive any answers fr

RE: Parsing multiple lines from text file using regex

2013-10-27 Thread Marc
>What was wrong with the answer Peter Otten gave you earlier today on the >tutor mailing list? > >-- >Python is the second best programming language in the world. >But the best has yet to be invented. Christian Tismer > >Mark Lawrence > I did not receive any answers from the Tutor list, so I tho

Re: Parsing multiple lines from text file using regex

2013-10-27 Thread Ben Finney
Roy Smith writes: > In article , > "Rhodri James" wrote: > > > I really, really wouldn't do this with a single regexp. You'll get a much > > easier to understand program if you implement a small state machine > > instead. > > And what is a regex if not a small state machine? Regex is not

Re: Parsing multiple lines from text file using regex

2013-10-27 Thread Roy Smith
In article , "Rhodri James" wrote: > I really, really wouldn't do this with a single regexp. You'll get a much > easier to understand program if you implement a small state machine > instead. And what is a regex if not a small state machine? -- https://mail.python.org/mailman/listinfo/pyt

Re: Parsing multiple lines from text file using regex

2013-10-27 Thread Mark Lawrence
On 27/10/2013 21:09, Marc wrote: Hi, I am having an issue with something that would seemtohave an easy solution,butwhich escapes me. I have configuration files that I would like to parse. The data I am having issue with is a multi-line attribute that has the following structure: banner Banne

Re: Parsing multiple lines from text file using regex

2013-10-27 Thread Rhodri James
On Sun, 27 Oct 2013 21:09:46 -, Marc wrote: Hi, I am having an issue with something that would seem to have an easy solution, but which escapes me. I have configuration files that I would like to parse. The data I am having issue with is a multi-line attribute that has the following struc