os.truncate() Method Syntax in Python
Syntax: os.truncate(path, length)
Parameters:
- path: This parameter is the path or file descriptor of the file that is to be truncated.
- length: This is the length of the file upto which file is to be truncated.
Return Value: This method does not returns any value.
Python | os.truncate() method
os.truncate()
method truncates the file corresponding to the path so that it is at the most length bytes in size. This function can support file descriptors too. In this article, we will learn about Python os.truncate() method.