-1

What is flush in the print function in python? What happens if it is set True? In what cases setting it True helps? Please provide good examples to understand. print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Niraj Raut
  • 165
  • 1
  • 7

1 Answers1

1

It forces print's output to the screen. In python 3 instead of doing this:

import sys
sys.stdout.flush()

You can use flush. Look here for more details.

xilpex
  • 2,929
  • 2
  • 11
  • 41