CoCalc Public Filestmp / pg.sagewsOpen in with one click!
Author: William A. Stein
import psycopg2 conn = psycopg2.connect("dbname='test' port=45412 host=localhost") cur = conn.cursor() cur.execute("SELECT * FROM people") rows = cur.fetchall() print "\nShow me the databases:\n" for row in rows: print " ", row[0]
Show me the databases: joe fred