Re: Python equivalent of Perl's $/

2007-08-20 Thread [EMAIL PROTECTED]
On Aug 20, 1:02 pm, John K Masters <[EMAIL PROTECTED]> wrote: > On 19:19 Mon 20 Aug , [EMAIL PROTECTED] wrote: > > > > > import StringIO > > > text = """\ > > To mimic Perl's input record separator in > > Python, you can use a generator. > > And a substring test. > > Perhaps something like the

Re: Python equivalent of Perl's $/

2007-08-20 Thread John K Masters
On 19:19 Mon 20 Aug , [EMAIL PROTECTED] wrote: > > import StringIO > > text = """\ > To mimic Perl's input record separator in > Python, you can use a generator. > And a substring test. > Perhaps something like the following > is what you wanted. > """ > > mockfile = StringIO.StringIO(text)

Re: Python equivalent of Perl's $/

2007-08-20 Thread [EMAIL PROTECTED]
On Aug 19, 11:13 am, John K Masters <[EMAIL PROTECTED]> wrote: > I am currently working my way through Jeffrey Friedl's book Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expression that interests me is '$/ = ".\n"' which, > rath

Re: Python equivalent of Perl's $/

2007-08-20 Thread John K Masters
On 10:30 Mon 20 Aug , Nick Craig-Wood wrote: > Something like this maybe? > > import re > > input_data = """I am currently working my way through Jeffrey Friedl's book > Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expre

Re: Python equivalent of Perl's $/

2007-08-20 Thread Nick Craig-Wood
John K Masters <[EMAIL PROTECTED]> wrote: > I am currently working my way through Jeffrey Friedl's book Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expression that interests me is '$/ = ".\n"' which, > rather than splitti

Re: Python equivalent of Perl's $/

2007-08-20 Thread Mark T
"John K Masters" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am currently working my way through Jeffrey Friedl's book Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expression that interests me is '$/ = ".\n"

Re: Python equivalent of Perl's $/

2007-08-20 Thread kyosohma
On Aug 19, 1:13 pm, John K Masters <[EMAIL PROTECTED]> wrote: > I am currently working my way through Jeffrey Friedl's book Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expression that interests me is '$/ = ".\n"' which, > rathe

Python equivalent of Perl's $/

2007-08-20 Thread John K Masters
I am currently working my way through Jeffrey Friedl's book Mastering Regular Expressions. Great book apart from the fact it uses Perl for the examples. One particular expression that interests me is '$/ = ".\n"' which, rather than splitting a file into lines, splits on a period-newline boundary.