Newbie Question : grep

2007-03-12 Thread moogyd
Hello, I am attempting to write my first Python script to extract some information from a file, and place it into another file. (I am trying to find the physical postions of 4 cells within an FPGA) I have a working solution, and would appreciate any comments. for line in lines: if placed in

Re: Newbie Question : grep

2007-03-12 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hello, I am attempting to write my first Python script to extract some information from a file, and place it into another file. (I am trying to find the physical postions of 4 cells within an FPGA) I have a working solution, and would appreciate any comments. for

Re: Newbie Question : grep

2007-03-12 Thread Erik Johnson
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip - If I increase number of elements I am searching for, then I have more elif...elif. Is there a cleaner solution? I'm not sure exactly what your lines look like, but this script implies that every line that matches 'i_a/i_b/ROM' is

Re: Newbie Question : grep

2007-03-12 Thread Erik Johnson
Sorry, I forgot to paste the modified version of my code in the post:. I think this is the same behaviour: for line in lines: if placed in line: if i_a/i_b/ROM/ in line: pos = (line.split()[4]).split(_)[1] found = False for (tag, (start, end)) in

Re: Newbie Question : grep

2007-03-12 Thread attn . steven . kuo
On Mar 12, 10:01 am, Erik Johnson [EMAIL PROTECTED] wrote: Sorry, I forgot to paste the modified version of my code in the post:. I think this is the same behaviour: for line in lines: if placed in line: if i_a/i_b/ROM/ in line: pos = (line.split()[4]).split(_)[1]

Re: Newbie Question : grep

2007-03-12 Thread moogyd
On 12 Mar, 18:55, [EMAIL PROTECTED] wrote: On Mar 12, 10:01 am, Erik Johnson [EMAIL PROTECTED] wrote: Sorry, I forgot to paste the modified version of my code in the post:. I think this is the same behaviour: for line in lines: if placed in line: if i_a/i_b/ROM/ in line:

Re: Newbie Question : grep

2007-03-12 Thread Larry Bates
[EMAIL PROTECTED] wrote: On 12 Mar, 18:55, [EMAIL PROTECTED] wrote: On Mar 12, 10:01 am, Erik Johnson [EMAIL PROTECTED] wrote: Sorry, I forgot to paste the modified version of my code in the post:. I think this is the same behaviour: for line in lines: if placed in line: if