Skip to content

Instantly share code, notes, and snippets.

@halit
Created January 27, 2014 16:28
Show Gist options
  • Select an option

  • Save halit/8651839 to your computer and use it in GitHub Desktop.

Select an option

Save halit/8651839 to your computer and use it in GitHub Desktop.
file follower
import sys
def tailf(f_file):
f_file.seek(0, 2)
while True:
l = f_file.readline()
if not l:
continue
yield l
if __name__ == "__main__":
if len(sys.argv) > 1:
tailf(open(sys.argv[1], "r"))
else:
print "Usage: tailf [file_name]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment