Created
March 9, 2015 19:39
-
-
Save csabatini/29e55235ceab86d175c6 to your computer and use it in GitHub Desktop.
MySQL-python
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 | |
db = MySQLdb.connect("localhost", "user", "pw", "census") | |
cursor = db.cursor() | |
sql = 'SELECT * FROM name' | |
cursor.execute(sql) | |
results = cursor.fetchall() | |
print len(results) | |
db.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment