# 缓冲区:cpu 一级缓存  二级缓存   三级缓存
import time

f =open('2.txt','a+' ,encoding='utf-8')

f.write('helloworld\n')
f.write('helloworld\n')
f.write('helloworld\n')
f.write('helloworld\n')
f.write('helloworld\n')
# 程序执行到这暂停,时间在sleep方法写数字
time.sleep(5)

# 清空缓冲区域(释放这个区域,将来可以分配任何数据),将缓冲区数据写入到硬盘
f.flush()

f.close()

  

相关文章:

  • 2021-09-29
  • 2022-02-28
  • 2021-08-26
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-12-05
  • 2021-06-09
  • 2021-05-21
  • 2021-08-27
相关资源
相似解决方案