Suppress cursor.execute() message in python MySQLdb
Question: How to suppress the cursor.execute() message in MySQLdb.

    
    
    >>> from warnings import filterwarnings
    >>> import MySQLdb
    >>> filterwarnings('ignore', category = MySQLdb.Warning)
    >>> db = MySQLdb.connect('127.0.0.1', 'root', '','')
    >>> cursor = db.cursor()
    >>> cursor.execute("select version()")
    1L
    

I need to suppress this '1L' message


Answer: What you see there is not a warning message, but the return value of
`cursor.execute()`. It's the number of rows affected, 1.

The API happens to return a Python [`long`
integer](http://docs.python.org/2/library/stdtypes.html#numeric-types-int-
float-long-complex), but it's otherwise the same as a regular `int` value:

    
    
    >>> 1L
    1L
    >>> 1
    1
    >>> 1 == 1L
    True
    

If you do not want the Python console to echo return values back to you,
assign them to a variable:

    
    
    >>> somevariable = 1L
    

