def writerow(self, row): self.writer.writerow( [compact.text_type(s).encode("utf-8") for s in row]) # Fetch UTF-8 output from the queue ... data = self.queue.getvalue() data = data.decode("utf-8") # ... and reencode it into the target encoding data = self.encoder.encode(data) # write to the target stream self.stream.write(data) # empty queue self.queue.truncate(0)
def writerow(self, row): self.writer.writerow([compact.text_type(s).encode("utf-8") for s in row]) # Fetch UTF-8 output from the queue ... data = self.queue.getvalue() data = data.decode("utf-8") # ... and reencode it into the target encoding data = self.encoder.encode(data) # write to the target stream self.stream.write(data) # empty queue self.queue.truncate(0)
def write_row(self, array): """ write a row into the file """ cells = [] for cell in array: try: cell = text_type(cell, errors="ignore") except TypeError: pass cells.append(cell) self._native_book.add_row(cells) self.current_row = 1