Re: File not read to end
"rb",,please <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'm trying to write a simple log parsing program. I noticed that it > isn't reading my log file to the end. > > My log is around 200,000 lines but it is stopping at line 26,428. I > checked that line and there aren't any special characters. > > This is the file reading code segment that I'm using: >sysFile=open(sysFilename,'r') >lineCount = 0 >for line in sysFile: >lineCount +=1 >print str(lineCount) + " -- " + line > > I also stuck this same code bit into a test script and it was able to > parse the entire log without problem. Very quirky. > > This is my first foray from Perl to Python so I appreciate any help. > > Thanks in advance. > > --Andrew > -- http://mail.python.org/mailman/listinfo/python-list
Re: How to parse the os.system() output in python
how to redirect the putput of the program to a file? thanks. "Sebastian Bassi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 17 Mar 2007 17:28:56 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: >> I use os.system() to execute a system command in python. >> Can you please tell me how can I parse (in python) the output of the >> os.system() ? > > Maybe you mean to parse the output of the program you run using > os.system. If this is the case, you should redirect the putput of the > program to a file (with ">") and then parse that file. > > Best, > SB. -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie help with array handling
use dir with list nested for example: {key1 : [value1, value2, value3], key2 : [value1, value2, vlaue4]} "loial" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form > > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,value2,value3 > etc > > I will later need to sort in keyvalue order and also need to be able > to check if a key already exists > > It is not clear how to do this in python. All the examples I see have > just a key and a single value > -- http://mail.python.org/mailman/listinfo/python-list