From Python, I want to execute a bash command (maybe with subprocess.Popen()) and I want to print the output and also to save the output in a variable or in a file, at the same time. This command returns a lot of text and it takes some hours to run.
If I redirect the output to a file, can I immediately print every new line which appears in this file?