def __str__(self):
        """
        Generate a formatted and colored string for this row.
        """
        def format_cell(color, item):
            column, value = item
            width = self.table.column_widths[column]
            return color(" {0}".format(value).ljust(1 + width))

        # get items in column order
        items = [(column, self[column]) for column in self.table.columns]
        # format cells with color and length
        colors_and_items = zip(cycle(self.table.colors), items)
        cells = [format_cell(color, item) for color, item in colors_and_items]
        return " ".join(cells)
def __str__ ( self ) : def format_cell ( color , item ) : column , value = item width = self . table . column_widths [ column ] return color ( " {0}" . format ( value ) . ljust ( 1 + width ) ) items = [ ( column , self [ column ] ) for column in self . table . columns ] colors_and_items = zip ( cycle ( self . table . colors ) , items ) cells = [ format_cell ( color , item ) for color , item in colors_and_items ] return " " . join ( cells )
Generate a formatted and colored string for this row.