CS 220 Parallel Computing

flush.py

DownloadView Raw

# File:     flush.py
# Purpose:  Demonstrate flushing the stdout buffer in Python
#
# Run:      python ./flush.py
#
#           To measure performance, run with the time command:
#               time python ./flush.py

for i in range(1000000):
    print(i, end=' ', flush=True)