# L-25 MCS 275 Wed 10 Mar 2010 : viewdbdata.py import MySQLdb def main(): """ Executes a simple query to the database. """ db = MySQLdb.connect(db="OurPyFiles") c = db.cursor() q = 'select * from scripts order by d' lc = c.execute(q) print 'found %d rows' % int(lc) while True: print c.fetchone() ans = raw_input('see more ? (y/n) ') if ans != 'y': break if __name__ == "__main__": main()