Created
February 7, 2013 21:26
-
-
Save lambdamusic/4734358 to your computer and use it in GitHub Desktop.
Python: MySQL-Python library #python #sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is it workingg?