RE: Whats the point of the truncate() function for writing to files? 01-07-2014, 12:57 AM
#4
(01-07-2014, 12:53 AM)Pens Wrote: Taken from the official python documentation:
Code:file.truncate([size]) Truncate the file’s size. If the optional size argument is present, the file is truncated to (at most) that size. The size defaults to the current position. The current file position is not changed. Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content. Availability: Windows, many Unix variants.
This being said, I have never used it nor do I see the need for it to be used in your case.
Just as I expected if I removed the truncate line it still works, thanks for the response
(01-07-2014, 12:54 AM)Necrosis Wrote: This might help you out.
http://stackoverflow.com/questions/45621...-in-python
Will check it out, thanks for the reply
(This post was last modified: 01-07-2014, 12:57 AM by Alan Turing.)
Unleash the lead from my pistol into my head bumpin' crystal



![[+]](https://sinister.li/images/modern/collapse_collapsed.png)