I am running a small cli python app in terminal. It loops infinitely and outputs text to the terminal. I want to output the text to a file, and I can do that with the following command python [my cli app] >> log.txt, but I have to break the loop first before the file is closed and effectively saved. Is there a way to read the latest contents from the text file while the loop keeps running in the background?SO BASICALLY:~ $  [INFINITE LOOP] >> log.txtthen while thats running forever, I want to access log.txt.At the moment, it only saves the terminal output to the file once I stop the command with Ctrl+C.I hope that explains it
Continously writing terminal output to text file
files;io redirection;text
simulation.py:(output 10 lines every second)#!/usr/bin/env pythonimport timei=0while True:    print({} what up {}.format(i,i%10))    if i%10==9:        time.sleep(1)    i+=1In one terminal:$ stdbuf -oL python simulation.py >> log.txtIn another one:$ tail -f log.txt #10 new lines every second