Python 文件 flush() 方法

实例

您可以在写入文件时清除缓冲:

  1. f = open("myfile.txt", "a")
  2. f.write("Now the file has one more line!")
  3. f.flush()
  4. f.write("...and another one!")

定义和用法

flush() 方法清除内部缓冲。

语法

  1. file.fileno()

参数值

无参数。