Re: [BangPypers] Parsing data

2011-09-19 Thread Ananya Sharma
Thank you everybody for your input. It helped a lot in understanding the logic i had to implement in the program. I am familiar with the concept of regular expressions but in this case line breaks would have been an issue. At the end, I did some more reading and browsed through examples and got the

Re: [BangPypers] Parsing data

2011-09-18 Thread Gopalakrishnan Subramani
At least I am not great at regular expressions. I agree that regex may reduce the number of lines,. On Sun, Sep 18, 2011 at 12:55 PM, mahendra N wrote: > Fgt the link > > http://code.google.com/edu/languages/google-python-class/regular-expressions.html > > 2011/9/19 mahendra N > > > Have you t

Re: [BangPypers] Parsing data

2011-09-18 Thread mahendra N
Fgt the link http://code.google.com/edu/languages/google-python-class/regular-expressions.html 2011/9/19 mahendra N > Have you thought of using regular expressions?. It might make ur job > easier. > > Checkout this link good explaination of reg exps. > > Thanks and Regards, > Mahendra Naik > > >

Re: [BangPypers] Parsing data

2011-09-18 Thread mahendra N
Have you thought of using regular expressions?. It might make ur job easier. Checkout this link good explaination of reg exps. Thanks and Regards, Mahendra Naik 2011/9/18 Gopalakrishnan Subramani > Senthil and Gora Mohanty pointed out whats wrong on the code. > > This is alternative option, no

Re: [BangPypers] Parsing data

2011-09-18 Thread Gopalakrishnan Subramani
Senthil and Gora Mohanty pointed out whats wrong on the code. This is alternative option, not its best since I feel always good to parse the file B based on file spec instead of the following approach. file_a_lines = open('FileA.txt').readlines() file_b_content = open('FileB.txt').read() for l

Re: [BangPypers] Parsing data

2011-09-17 Thread Senthil Kumaran
On Fri, Sep 16, 2011 at 11:26:34PM -0500, Ananya Sharma wrote: > > *File A-* > >PSUB.GBD61H402FPT34:0-372 > > *File B-* > >PSUB.GBD61H402FPT34:0-372 > XX > XX >

Re: [BangPypers] Parsing data

2011-09-17 Thread Gora Mohanty
On Sun, Sep 18, 2011 at 2:19 AM, Ananya Sharma wrote: > The logic is that i have file A which has some names and file B which has > values for each name in file A and some extra values. I want to make a > script which gives me the values from file B corresponding to all the names > given in file A

Re: [BangPypers] Parsing data

2011-09-17 Thread Ananya Sharma
The logic is that i have file A which has some names and file B which has values for each name in file A and some extra values. I want to make a script which gives me the values from file B corresponding to all the names given in file A. My files look like - *File A-* >PSUB.GBD61H402FPT34:0-372 >P

Re: [BangPypers] Parsing data

2011-09-17 Thread Gora Mohanty
On Sat, Sep 17, 2011 at 9:33 PM, Ananya Sharma wrote: > I am trying to look up each value from file A and loop it through file B. As > i already said that I am new in python programming so this is what I could > come up with. Um, the code is quite far from accomplishing that. While I am sure that

Re: [BangPypers] Parsing data

2011-09-17 Thread Ananya Sharma
I am trying to look up each value from file A and loop it through file B. As i already said that I am new in python programming so this is what I could come up with. And this is the output of an algorithm I use in my research so its not a part of any homework assignment. On Sat, Sep 17, 2011 at 1:

Re: [BangPypers] Parsing data

2011-09-16 Thread Gora Mohanty
On Sat, Sep 17, 2011 at 9:56 AM, Ananya Sharma wrote: [...] Could you explain the logic that you are trying to use in the code below, because it is not making much sense. Also, is this a homework problem? > *Script-* > * > * > f1=open('fileA','r') > f2=open('fileB','r') > a="" > b="" > for n in

[BangPypers] Parsing data

2011-09-16 Thread Ananya Sharma
Hey, I am just a beginner in python. I have to write a script to parse a data file I have written a script but it is not working. Can anybody please help me to fix it? Let me explain the task I want to accomplish using this script. I have 2 files A and B. File A has ~1450 names which have a corre