extract substring by regex from a text file

Alessio alessio.dl at gmail.com
Sat Apr 17 04:19:41 EDT 2010


On Apr 15, 3:25 pm, Neil Cerutti <ne... at norwich.edu> wrote:
> On 2010-04-15, Alessio <alessio... at gmail.com> wrote:
>
> > Hi,
>
> > I'm facing the problem in the subject:
> > - I have a text file that I need to parse for producing a specifical
Thank you, I forgot to say that I already solved.
I used readlines() to read my text file, then with a for cicle I
extract line by line the substrings I need by regular expressions
(re.findall())

ciao


> > string (Json like) extracting some information (substring) in it;
> > - I created regural expressions capable to locate these substrings in
> > my txt file;
>
> > now I don't know how to continue. What is the best way to locate some
> > string in a file and output them (with print command or in another
> > file)?
>
> grep
>
> Or: show your work.
>
> --
> Neil Cerutti




More information about the Python-list mailing list