Pregunta:
Como conectar a MySQL desde Python ?
Respuesta:
Código:
import MySQLdb
conn = MySQLdb.connect (host = "servidor", user = "usuario", passwd = "contraseña", db = "basedatos")
cursor = conn.cursor ()
cursor.execute ("SELECT id, nombre FROM clientes")
tabla = cursor.fetchall()
for fila in tabla:
print "id:", fila[0], "nombre:", fila[1]
cursor.close ()
conn.close ()
Más info:
http://dev.mysql.com/usingmysql/python/