Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2016dc9

Browse files
committed
Merged revisions 81594 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r81594 | antoine.pitrou | 2010-05-29 14:06:13 +0200 (sam., 29 mai 2010) | 3 lines Issue #8840: Make documentation for truncate() clearer ........
1 parent 43fb009 commit 2016dc9

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Doc/library/io.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,12 @@ I/O Base Classes
314314

315315
.. method:: truncate(size=None)
316316

317-
Truncate the file to at most *size* bytes. *size* defaults to the current
318-
file position, as returned by :meth:`tell`. Note that the current file
319-
position isn't changed; if you want to change it to the new end of
320-
file, you have to :meth:`seek()` explicitly.
317+
Resize the stream to the given *size* in bytes (or the current position
318+
if *size* is not specified). The current stream position isn't changed.
319+
This resizing can extend or reduce the current file size. In case of
320+
extension, the contents of the new file area depend on the platform
321+
(on most systems, additional bytes are zero-filled, on Windows they're
322+
undetermined). The new file size is returned.
321323

322324
.. method:: writable()
323325

0 commit comments

Comments
 (0)