Skip to content

Instantly share code, notes, and snippets.

@orimanabu
Created December 4, 2010 21:34
Show Gist options
  • Save orimanabu/728500 to your computer and use it in GitHub Desktop.
Save orimanabu/728500 to your computer and use it in GitHub Desktop.
"tail -f" in python
#!/usr/local/bin/python
import sys
import time
file = open(sys.argv[1])
while True:
where = file.tell()
line = file.readline()
if not line:
time.sleep(1)
file.seek(where)
else:
print line,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment