In a Python script I copy a directory tree and would like to print some text like this...
print("Copying... ", end="")
shutil.copytree(src, dest)
print("DONE")
However the text Copying...
is not printed until the script has finished.
You need to flush STDOUT, but no need to bring sys.stdout
into the picture. print
can do that for you:
print("Copying... ", end="", flush=True)
shutil.copytree(src, dest)
print("DONE")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments