[Tutor] log parsing

Kent Johnson kent37 at tds.net
Wed Nov 30 04:36:26 CET 2005

Will Harris wrote:
> I am trying to work out doing a bit of log parsing in python. Below is 
> the code I have gotten so far, It works in an earlier version of this 
> one but this one doesn't print out the lines in my log files. Does 
> anyone see anything that I am missing here or can just point me in the 
> direction to look?
>     for logs in sys.argv[1:]:
>       open(logs)
>       for line in logs:

This should be something like
  f = open(logs)
  for line in f:

You are opening the file and throwing it away, then iterating over the command line argument.



More information about the Tutor mailing list