/ Published in: Python
URL: http://magicrebirth.wordpress.com/2009/08/30/mysql-python-and-apple-osx-10-5-leopard/
Expand |
Embed | Plain Text
import MySQLdb conn = MySQLdb.connect(host=\"localhost\", user=\"root\", passwd=\"nobodyknow\", db=\"amit\") cursor = conn.cursor() stmt = \"SELECT * FROM overflows\" cursor.execute(stmt) # Fetch and output result = cursor.fetchall() print result # get the number of rows numrows = int(cursor.rowcount) # Close connection conn.close()
You need to login to post a comment.
