标签:div none buffer keyword encoding 直接 设置 ror 读取文件
>>> f2
=
open
(
‘/tmp/test.txt‘
,
‘r+‘
)
>>> f2.read()
‘hello girl!‘
>>> f2.write(
‘\nhello boy!‘
)
>>> f2.close()
hello girl!
hello boy!
close()
,操作系统才把缓存数据写入写入磁盘。其中参数buffering控制缓冲行为
buffering默认为-1,系统默认的全缓冲
buffering可以设置为大于1的任意整数,字节数为buffering的全缓冲
buffering=1,设置为行缓冲模式
buffering=0, 设置为无缓冲模式
标签:div none buffer keyword encoding 直接 设置 ror 读取文件
原文地址:https://www.cnblogs.com/HISAK/p/11625517.html