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