def list_of_dict ( self ) : ret = [ ] for row in self : ret . append ( dict ( [ ( self . _col_names [ i ] , row [ i ] ) for i in range ( len ( self . _col_names ) ) ] ) ) return ReprListDict ( ret , col_names = self . _col_names , col_types = self . _col_types , width_limit = self . _width_limit , digits = self . _digits , convert_unicode = self . _convert_unicode )
python turn resylts of query to dictionary
This will convert the data from a list of list to a list of dictionary : return : list of dict
def list_of_dict(self):
        """
        This will convert the data from a list of list to a list of dictionary
        :return: list of dict
        """
        ret = []
        for row in self:
            ret.append(dict([(self._col_names[i], row[i]) for i in
                             range(len(self._col_names))]))
        return ReprListDict(ret, col_names=self._col_names,
                            col_types=self._col_types,
                            width_limit=self._width_limit,
                            digits=self._digits,
                            convert_unicode=self._convert_unicode)