numrows = int(cursor.rowcount) if numrows == 0: return "no results" else: values = [] for dataR in cursor.fetchone(): for row in dataR: values += [str(value) for value in row] return str.join('\n', values)