Function Details: flush

Description


Flush the write buffers of the stream if applicable.


Extended Description


The flush() method forces a write of all buffered data to the underlying stream. It's particularly useful when you need to ensure that all data has been written to the file or device, especially before closing the file or when you need the data to be immediately available to other processes.


Function Signature



Module: io

Class: TextIOWrapper

Parameters



Return


This method doesn't return a value.


Return Type


None

Output

Explanation

This example demonstrates the basic usage of flush(). After writing 'Hello' to the file, flush() is called to ensure the data is written to disk immediately.