(self, data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
Open the file in text mode, write to it, and close the file.
Open the file in text mode write to it and close the file .
def write_text(self, data, encoding=None, errors=None, newline=None):
        """
        Open the file in text mode, write to it, and close the file.
        """
        if not isinstance(data, str):
            raise TypeError('data must be str, not %s' %
                            data.__class__.__name__)
        encoding = io.text_encoding(encoding)
        with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
            return f.write(data)
def write_text ( self , data , encoding = None , errors = None , newline = None ) : if not isinstance ( data , str ) : raise TypeError ( 'data must be str, not %s' % data . __class__ . __name__ ) encoding = io . text_encoding ( encoding ) with self . open ( mode = 'w' , encoding = encoding , errors = errors , newline = newline ) as f : return f . write ( data )