# 缓冲区:cpu 一级缓存 二级缓存 三级缓存import timef =open('2.txt','a+' ,encoding='utf-8')f.write('helloworld
')f.write('helloworld
')f.write('helloworld
')f.write('helloworld
')f.write('helloworld
')# 程序执行到这暂停,时间在sleep方法写数字time.sleep(5)# 清空缓冲区域(释放这个区域,将来可以分配任何数据),将缓冲区数据写入到硬盘f.flush()f.close()
------- 知识无价,汗水有情,如需搬运请注明出处,谢谢!
版权声明
本文仅代表作者观点,不代表百度立场。
本文系作者授权百度百家发表,未经许可,不得转载。




