[Tutor] tail -f
Kalle Svensson
kalle@gnupung.net
Fri, 20 Apr 2001 12:49:14 +0200
Sez Baris Metin:
> How can I read a file continuously, like the command "tail -f" on unix
> systems ?
>
> Do I have to open and close file ?
No, just reading from it should work:
f = open("fisk")
import time
while 1:
print f.read()
time.sleep(1)
f.close()
will print all new text in the file every time through the loop.
Peace,
Kalle
--
Email: kalle@gnupung.net | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
[ Not signed due to lossage. Blame Microsoft Outlook Express. ]