(For some reason you keep top-posting. Add your comments to the end, or inline if appropriate)

bibi midi wrote:
Yep it works! I understand now it iterates on each line and replaces the old
elements with the new ones. In the end you get the latest date of the last
line of log.

I will work on the exception handling and other refinements. Thanks.



On Tue, Oct 27, 2009 at 8:41 AM, Christian Witts <cwi...@compuscan.co.za>wrote:

<snip>
   for line in open(log_file):
     last_log_date = ' '.join(line.split(' ')[:3]


In an earlier example, you already had a for loop on the log_file so the last line would still be in the variable "line". If you put the date logic right after the loop, there'd be nothing wrong with using the last line that way. Beats going back through the file and repeating it all again.

DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to