import time import sys sys.stdout.write(\"1\") time.sleep(5) print(\"2\")
will print \"12\" after 5 seconds
import time import sys
Because stdout is buffered. You may be able to force the output sooner with a sys.stdout.flush() call.
stdout
sys.stdout.flush()