import psycopg2 as sgbd

cnx = sgbd.connect(host="localhost", user="alice", \
                   password="secret")

c = cnx.cursor()

c.execute("SELECT * FROM livre WHERE annee < 1990")

for l in c.fetchall():
    print(l[0], l[2])

cnx.close()