# Collection of code snippets by Arne Vajhøj 
# (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import pymysql

print('MySQL from Python')
con = pymysql.connect(host='192.168.0.10',user='root',password='',db='test')
c = con.cursor()
c.execute('SELECT f1,f2 FROM t1')
data = c.fetchall()
c.close()
for row in data:
    print('%d %s' % (row[0], row[1]))
con.close()
