Xah Lee wrote: > i switched to system call with tail because originally i was using a > pure Python solution > > inF = gzip.GzipFile(ff, 'rb'); > s=inF.readlines() > inF.close() > last_line=s[-1] > > and since the log file is 100 megabytes it takes a long time and hogs > massive memory.
How about: inF = gzip.GzipFile(ff, 'rb') for line in inF: pass last_line = line It's a bit slower than gzip and tail, but the memory usage is fine. -- http://mail.python.org/mailman/listinfo/python-list