Code Tidy - Pastebin

New     Fork     Embed     View raw     Report
Tail for Python - python

Embed

You can embed this paste into a blog or website with this code:

<iframe class="codetidy" type="text/html" width="100%" src="http://codetidy.com/paste/embed/1845" frameborder="0"></iframe>

Add comment

Captcha
  1. import time?
  2. import sys?
  3.  ?
  4.  ?
  5. def tail_f(file):?
  6.     interval = 0.5?
  7.  ?
  8.     while True:?
  9.         where = file.tell()?
  10.         line = file.readline()?
  11.         if not line:?
  12.             time.sleep(interval)?
  13.             file.seek(where)?
  14.         else:?
  15.             yield line?
  16.  ?
  17.  ?
  18.  ?
  19. for line in tail_f(open(sys.argv[1])):?
  20.     print line,?
© 2011 Code Tidy  Terms and conditions