def _format_list ( result ) : if not result : return result if isinstance ( result [ 0 ] , dict ) : return _format_list_objects ( result ) table = Table ( [ 'value' ] ) for item in result : table . add_row ( [ iter_to_table ( item ) ] ) return table
outputting lists into tables python
Format list responses into a table .
def _format_list(result):
    """Format list responses into a table."""

    if not result:
        return result

    if isinstance(result[0], dict):
        return _format_list_objects(result)

    table = Table(['value'])
    for item in result:
        table.add_row([iter_to_table(item)])
    return table