Re: [Tutor] help with re module and parsing data

2011-03-07 Thread Steven D'Aprano
On Mon, 7 Mar 2011 06:54:30 pm vineeth wrote: > Hello all I am doing some analysis on my trace file. I am finding the > lines Recvd-Content and Published-Content. I am able to find those > lines but the re module as predicted just gives the word that is > being searched. But I require the entire l

Re: [Tutor] help with re module and parsing data

2011-03-07 Thread wesley chun
>> import re >> file = open('file.txt','r') >> file2 = open('newfile.txt','w') >> >> LineFile = ' ' >> >> for line in file: >>    LineFile += line >> >> StripRcvdCnt = re.compile('(P\w+\S\Content|Re\w+\S\Content)') >> >> FindRcvdCnt = re.findall(StripRcvdCnt, LineFile) >> >> for SrcStr in FindRcvdC

Re: [Tutor] help with re module and parsing data

2011-03-07 Thread Kushal Kumaran
On Mon, Mar 7, 2011 at 1:24 PM, vineeth wrote: > Hello all I am doing some analysis on my trace file. I am finding the lines > Recvd-Content and Published-Content. I am able to find those lines but the > re module as predicted just gives the word that is being searched. But I > require the entire

[Tutor] help with re module and parsing data

2011-03-06 Thread vineeth
Hello all I am doing some analysis on my trace file. I am finding the lines Recvd-Content and Published-Content. I am able to find those lines but the re module as predicted just gives the word that is being searched. But I require the entire line similar to a grep in unix. Can some one tell m