Python file truncate() method
Python File truncate() Method The truncate() method truncates a file to a certain size. If the optional size argument is provided, the file will be truncated to at most that size. The size defaults to the current position. The current…