cxn = psycopg2.connect(user='postgres',password='root')cur = cxn.cursor()cur.execute('SELECT * FROM pg_database')rows = cur.fetchall()for i in rows: print icur.close()cxn.commit()cxn.close()