(self, data)
Open the file in bytes mode, write to it, and close the file.
Open the file in bytes mode, write to it, and close the file.
Open the file in bytes mode write to it and close the file .
def write_bytes(self, data):
        """
        Open the file in bytes mode, write to it, and close the file.
        """
        # type-check for the buffer interface before truncating the file
        view = memoryview(data)
        with self.open(mode='wb') as f:
            return f.write(view)
def write_bytes ( self , data ) : # type-check for the buffer interface before truncating the file view = memoryview ( data ) with self . open ( mode = 'wb' ) as f : return f . write ( view )