Python File Truncate, Definition and Usage The truncate() method resizes the file to the given number of bytes.