1

For example, the youtube-dl command.

In Powershell, there is a progress bar that is continuously updated while downloading.

like the third line in this image

5zfn9U.png

But in python,the third line of output will only appear after it reaches 100%.

5zfN9O.png

This is my code.

import subprocess
f = subprocess.Popen('youtube-dl -f 160 https://youtu.be/W8l5zlR_3_E', shell=True, stdout=subprocess.PIPE)
for i in f.stdout:
    print(i.decode(encoding="utf-8"), end="")
キラル
  • 31
  • 5

0 Answers0