1
如何在MySQLdb中抑制cursor.execute()消息。在python MySQLdb中抑制cursor.execute()消息
>>> 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
我需要抑制這種「1L」消息
這不是一條消息,那是*返回值*。 –
@馬丁,謝謝。我能壓制這個值嗎? – Curious
將它分配給一個變量?你爲什麼需要抑制它? –