Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python file detach() method is used to separate the underlying raw stream from the buffer and return it. After the raw stream has been detached, the buffer is in an unusable state.

Some buffers, like BytesIO, do not have the concept of a single raw stream to return from this method. They raise UnsupportedOperation.

Syntax

file.detach()

Parameters

No parameter is required.

Return Value

Returns the underlying raw stream separated from the buffer.

Exception

throws UnsupportedOperation, if the buffer do not have the concept of a single raw stream to return from this method.

❮ Python File Handling Methods