flush ouput python code example Example 1: print flush python import sys sys.stdout.flush() Example 2: print flush python print("Hello world!", flush=True)