Python 文件 flush() 方法
实例
在写入文件时清除缓冲区:f = open("myfile.txt", "a")
f.write("Now the file has one more line!")
f.flush()
f.write("...and another one!")
运行示例»定义和用法
flush()方法清除内部缓冲区。
语法
file.fileno()
f = open("myfile.txt", "a")
f.write("Now the file has one more line!")
f.flush()
f.write("...and another one!")
运行示例»flush()方法清除内部缓冲区。