On Sat, 05 Oct 2013 00:38:51 -0700, galeomaga wrote: > #!/usr/bin/python > import time > f = open('/home/martin/Downloads/a.txt') > while 1: > for line in f: > print line; > time.sleep(1);
So you're trying to implement "tail -f"? First, check that "tail -f" actually works for your particular use case. If the process writing the file uses buffered output, data will only actually be appended to the file when the buffer is full. You can't read what isn't there. And if the process creates a new file with the same name, rather than appending to the existing file, you'll still be reading the old file. You would need to open the file again to read the new file. -- https://mail.python.org/mailman/listinfo/python-list