Re: [Tutor] Python Newbie: Lost in Loop

2008-04-04 Thread yogi
Hi all , Thanks for the input. I must add Kent's solution was the fastest. The actual file to parse is 12MB. Though Eric's solution was more readable ( atleast for me). Now that I have the logic and code right I have to work on the real problem. Thanks in advance, yogesh

Re: [Tutor] Python Newbie: Lost in Loop

2008-04-04 Thread Eric Walstad
Hi Yogi, welcome to Python! yogi wrote: ... > if (str(gen) == str(row[0])): > print 'Match for 16 found Is the conversion to string really necessary? Even if it is, do it once for gen, when you define it: gen = '16' so you don't have to convert on every iteration of the

Re: [Tutor] Python Newbie: Lost in Loop

2008-04-04 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote > Aside to the list: > Did anyone else know that you can assign to a list element > as the target of a for statement? Nope, and in fact I was just trying it out at the >>> prompt when your message came in! On a general point for the OP, I doubt if you n

Re: [Tutor] Python Newbie: Lost in Loop

2008-04-04 Thread Kent Johnson
yogi wrote: > Hi all, > I ´m a Python Newbie. Just 48 hrs into Python. > I am trying to parse a file which is tab spaced. You're close... > My Python code > #/bin/python > import sys, csv, re > > # This programme finds the SNPs from the range passed from > the select option > ## But f

[Tutor] Python Newbie: Lost in Loop

2008-04-04 Thread yogi
Hi all, I ´m a Python Newbie. Just 48 hrs into Python. I am trying to parse a file which is tab spaced. head -5 of the file in question. 1 rs3094315 0 792429 1 rs6672353 0 817376 1 rs4040617 0 819185 1 rs2980300 0 8