+ 1
file.truncate()
what does file.truncate() exactly do ?
2 Respostas
+ 3
It truncates everything past what you have already read.
https://www.tutorialspoint.com/JUMP_LINK__&&__python__&&__JUMP_LINK/file_truncate.htm
+ 3
...and one way people use it is to immediately 'zero' a file without actually deleting it (and then losing its name or position in the file system); sometimes specifically because it's faster.