Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
python文件对象如何从当前种子位置删除字节到结束
f = open(filename, "a+")
truncate_pos = f.tell()
f.truncate(truncate_pos)
似乎不起作用,我该怎么办?
打开文件a+将指针定位在文件末尾;从那里截断不会导致文件更改。
a+