Home >>Python File Methods >Python File flush() Method
Python file flush() method is used to clean out the internal buffer.
Syntax:file.flush()Here is na example of Python flush() method:
f = open("myfile.txt", "a")
f.write("Now the file has one more line!")
f.flush()
f.write("...and another one!")