pytailer

Python tail is a simple implementation of GNU tail and head
Download

pytailer Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Mike Thornton
  • Publisher web site:
  • http://clom.rtfd.org

pytailer Tags


pytailer Description

Python tail is a simple implementation of GNU tail and head.It provides 3 main functions that can be performed on any file-like object that supports seek() and tell().- tail - read lines from the end of a file- head - read lines from the top of a file- follow - read lines as a file growsIt also comes with pytail, a command line version offering the same functionality as GNU tail. This can be particularly useful on Windows systems that have no tail equivalent.- Tailer on GitHub- Tailer on PypiInstallationInstall with pip or easy_install.pip install tailerExamplesimport tailerf = open('test.txt', 'w')for i in range(11): f.write('Line %d\\n' % (i + 1))f.close()Tail# Get the last 3 lines of the filetailer.tail(open('test.txt'), 3)# Head# Get the first 3 lines of the filetailer.head(open('test.txt'), 3)# Follow# Follow the file as it growsfor line in tailer.follow(open('test.txt')): print lineRunning TestsTailer currently only has doctests.Run tests with nose:nosetests --with-doctest src/tailerRun tests with doctest:python -m doctest -v src/tailer/__init__.pyProduct's homepage


pytailer Related Software