# flush()使用 !/usr/bin/python -*- coding: UTF-8 -*- # 打开文件 fo = open("runoob.txt", "wb") print("文件名为: ", fo.name) # 刷新缓冲区 fo.flush() # 关闭文件 fo.close()