Re: issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Damon Getsman
On May 21, 11:15 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > for cur_rec in Lastdump.readline(): > > is the problem. readline() returns a string containing the next > line's worth of text, NOT an iterator over all the subsequent lines in > the file. So your code is really saying: > >

Re: issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Paul McGuire
On May 21, 10:59 am, Damon Getsman <[EMAIL PROTECTED]> wrote: > I'm having an issue parsing lines of 'last' output that I have stored > in a /tmp file.  The first time it does a .readline() I get the full > line of output, which I'm then able to split() and work with the > individual fields of with

Re: issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Damon Getsman
Okay, so I manged to kludge around the issue by not using the .readline() in my 'for' statement. Instead, I'm slurping the whole file into a new list that I put in for that purpose, and everything seems to be working just fine. However, I don't know WHY the other method failed and I'm at a loss f

issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Damon Getsman
Okay so I'm writing a script in python right now as a dirty fix for a problem we're having at work.. Unfortunately this is the first really non-trivial script that I've had to work with in python and the book that I have on it really kind of sucks. I'm having an issue parsing lines of 'last' outp