Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement