Curently I am using subporcess library on widows to execute comand in cmd. My problem is that I would like to display the output of cmd in the real time. I am able to display output after comand exececute her job. Is it possible to do display the output in real time?
My code looks like this:
import subprocess
def get_output(command):
process = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
output = process.communicate()[0]
return output.decode('utf-8')
print(get_output('ping 8.8.8.8'))