tried both again, they both return the same 9 lines, when i expect 492. it dies on a blank line, but the if i_line takes care of the previous ones.
On Mon, Jun 22, 2009 at 4:21 PM, vince spicer<vinces1...@gmail.com> wrote: > 14mb file shouldn't be an issue, unless you very little ram, is there any > errors being outputted? > > a cleaner way for reading the file: > > for line in open("output.new"): > if line.startswith("intrinsic"): > print line > > > On Mon, Jun 22, 2009 at 2:16 PM, Bryan Fodness <bryan.fodn...@gmail.com> > wrote: >> >> I am trying to output all the lines that start with a specific word. >> It is a large output file (~14 Mb), but nothing that I thought would >> be a problem. >> >> for line in open('output.new'): >> i_line = line.split() >> if i_line: >> if i_line[0] == "intrinsic": >> print i_line >> >> It does not get all of the lines, it stops at line 130323. There are >> ~260000 line. Is there a limit to the number of lines you can read in >> this way, or am I overlooking something else. >> >> Bryan >> _______________________________________________ >> Tutor maillist - tu...@python.org >> http://mail.python.org/mailman/listinfo/tutor > > -- “The game of science can accurately be described as a never-ending insult to human intelligence.” - João Magueijo "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. " -Albert Einstein _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor