<p>How do I force Python's <code>print</code> function to flush the buffered output to the screen?</p>

In Python 3,
```
print
```
can take an optional
```
flush
```
argument:
```
```
print("Hello, World!", flush=True)
```
```
In Python 2, after calling
```
print
```
, do:
```
```
import sys
sys.stdout.flush()
```
```
By default,
```
print
```
prints to
```
sys.stdout
```
(see the documentation for more about
file objects
).