Skip to content

Instantly share code, notes, and snippets.

@marzsv
Created August 22, 2016 20:16
Show Gist options
  • Save marzsv/0ba4049f3a0cec079457e0bd3acee893 to your computer and use it in GitHub Desktop.
Save marzsv/0ba4049f3a0cec079457e0bd3acee893 to your computer and use it in GitHub Desktop.
from MySQLdb import connect
conn = connect(db="test", user="root", passwd="root", host="127.0.0.1")
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")
for user in cursor:
print("Id: {}, Name: {}".format(user[0], user[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment