How to streamingly read text file and display whenever updated text
galeomaga at gmail.com
galeomaga at gmail.com
Sat Oct 5 03:54:39 EDT 2013
gale... at gmail.com於 2013年10月5日星期六UTC+8下午3時38分51秒寫道:
> #!/usr/bin/python
>
> import time
>
> f = open('/home/martin/Downloads/a.txt')
>
> while 1:
>
> for line in f:
>
> print line;
>
> time.sleep(1);
if __name__ == '__main__':
logfile = open("/home/martin/Downloads/a.txt","r");
while True:
line = logfile.readline();
if not line:
print line;
time.sleep(1);
this also failed
More information about the Python-list
mailing list