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() 方法清除內部緩沖。
file.fileno()
無參數。