How to streamingly read text file and display whenever updated text

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Oct 5 04:12:55 EDT 2013


On 05/10/2013 08:54, galeomaga at gmail.com wrote:
>
> 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
>

Usually please state your OS and Python versions, what you expected to 
happen, what actually happened and the full traceback if applicable.  In 
this case I'd hazard a guess that as you're trying to print something 
that evaluates to false you're not likely to see much.  You can also 
remove the semicolons as they're simply not needed.

-- 
Roses are red,
Violets are blue,
Most poems rhyme,
But this one doesn't.

Mark Lawrence




More information about the Python-list mailing list