flush () use

When writing a file, the file for a long time sometimes find there is no written content, if you want to quickly see the contents written, so this time we can use flush ()

 

Advantages and disadvantages:

    1, when the file calls the write file, followed by calls f.flush (), it will be written to disk after to write immediately, open the file you will see the contents of their own writing, the advantage is quickly written to disk file

2, the disadvantages are also obvious, disk read and write IO operations belong, then such frequent writing to disk, it will lead to a large number of IO, affect the performance of the system

 

Note: according to the actual situation, to assess whether or not to use this method

Guess you like

Origin www.cnblogs.com/xiaokuangnvhai/p/10984099.html