results itself is an object of a string in your case (judging by the declared output of print ), a dictionary (you probably configured a subclass of dict-like cursor ); just hit the count key:
result = cur.fetchone() print result['count']
Since you used .fetchone() , only one line is returned, not a list of lines.
If you are not using the dict (-like) line cursor, the rows are tuples, and the count value is the first value:
result = cur.fetchone() print result[0]
source share