def close ( self ) : if not self . _closed : self . __flush ( ) object . __setattr__ ( self , "_closed" , True )
python close flush object
Flush the file and close it .
def close(self):
        """Flush the file and close it.

        A closed file cannot be written any more. Calling
        :meth:`close` more than once is allowed.
        """
        if not self._closed:
            self.__flush()
            object.__setattr__(self, "_closed", True)