Created
July 29, 2016 03:42
-
-
Save evilnapsis/954c840a7db4f24f1a93e1ee2d1a9b6b to your computer and use it in GitHub Desktop.
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(host="127.0.0.1", user="root",passwd="",db="pyex1") | |
# ejecutar consultas: insert, update, delete | |
cursor = db.cursor() | |
cursor.execute("insert into person(name,lastname) value('Agustin','Ramos')"); | |
db.commit() | |
# ejecutar consultas select | |
cursor = db.cursor() | |
cursor.execute("select * from person"); | |
data=cursor.fetchall() | |
for d in data: | |
print "{0} - {1} {2}".format(d[0],d[1],d[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment