Koristi modul MySQLdb a ne _mysql. MySQLdb podrzava DB-API 2.0 specifikaciju.
Modul se nalazi na SourceForge-tu:
http://sourceforge.net/projects/mysql-python/
Primer:
Code:
import MySQLdb
db = MySQLdb.Connect(host='localhost', user='alex', passwd='alex', db='alex')
cursor = db.cursor()
cur.execute("select * from diary")
rows = cur.fetchall()
for row in rows:
print row[1],row[2]
(napomena, print komanda je indented, odnosno "uvucena", jer je deo for petlje)
Alex: My favorite site is
http://localhost/
R.J. Oppenheimer: "I am become death, destroyer of worlds" (1945 AD)
tweet.13x ||
linkedin.13x