Re: [Tutor] Extract strings from a text file

2009-02-27 Thread عماد نوفل
On Fri, Feb 27, 2009 at 10:01 AM, Paul McGuire wrote: > Emad wrote: > >>> > Since I'm learning Pyparsing, this was a nice excercise. I've written this > elementary script which does the job well in light of the data we have > > from pyparsing import * > ID_TAG = Li

Re: [Tutor] Extract strings from a text file

2009-02-27 Thread Paul McGuire
Emad wrote: >>> Since I'm learning Pyparsing, this was a nice excercise. I've written this elementary script which does the job well in light of the data we have from pyparsing import * ID_TAG = Literal("") FULL_NAME_TAG1 = Literal("") END_TAG = Literal("', 'Joseph

Re: [Tutor] Extract strings from a text file

2009-02-27 Thread Kent Johnson
On Fri, Feb 27, 2009 at 2:22 AM, spir wrote: > Anyway for a startup exploration you can use regular expressions (regex) to > extract individual data item. For instance: > > from re import compile as Pattern > pattern = Pattern(r""".*(.+)<.+>.*""") > line = "text text text Joseph" > print pattern.

Re: [Tutor] Extract strings from a text file

2009-02-27 Thread عماد نوفل
On Fri, Feb 27, 2009 at 2:59 AM, wesley chun wrote: > > There is a text file that looks like this: > > > > text text text Joseph > > text text text text text text text text text text text > > text text text text text text text text text text text > > text text text text text text text text text t

Re: [Tutor] Extract strings from a text file

2009-02-27 Thread wesley chun
> There is a text file that looks like this: > > text text text Joseph > text text text text text text text text text text text > text text text text text text text text text text text > text text text text text text text text text text text > text text text text text text text text text text text

Re: [Tutor] Extract strings from a text file

2009-02-26 Thread spir
Le Thu, 26 Feb 2009 21:53:43 -0800, Mohamed Hassan s'exprima ainsi: > Hi all, > > I am new to Python and still trying to figure out some things. Here is the > situation: > > There is a text file that looks like this: > > text text text Joseph > text text text text text text text text text text