DEV Community

Discussion on: 30 Days of Python 👨‍💻 - Day 18 - File I/O

Collapse
 
arindamdawn profile image
Arindam Dawn

The flush() method basically clears the write buffer. This is the same thing that happens when closing the file, but flush leaves the file open for more writing. You shouldn't usually have a need to call this method explicitly.