(self, data, filename=None)
return self.zip.writestr(str(filename), data)
Write to the file.
Write to the file.
Write to the file .
def write(self, data, filename=None):
        """Write to the file."""
        if self.zip is None:
            if isinstance(data, (str, unicode)):
                return self._file_object.write(data.encode('utf-8'))
            return self._file_object.write(data)
        if filename is None:
            raise TypeError('filename required when writing to zip')
        return self.zip.writestr(str(filename), data)
def write ( self , data , filename = None ) : if self . zip is None : if isinstance ( data , ( str , unicode ) ) : return self . _file_object . write ( data . encode ( 'utf-8' ) ) return self . _file_object . write ( data ) if filename is None : raise TypeError ( 'filename required when writing to zip' ) return self . zip . writestr ( str ( filename ) , data )