import datetime
from mx import DateTime
from dbfpy import dbf
import psycopg2
## read DBF and print records
try:
conn = psycopg2.connect("dbname='postgres' user='postgres' host='localhost' password='19071990'")
except:
print "I am unable to connect to the database"
cur = conn.cursor()
db = dbf.Dbf("SPI/lv810304.dbf")
for rec in db:
print rec[0], rec[1],rec[2]
v1=rec[0]
v2=rec[1]
v3=rec[2]
cur.execute("INSERT INTO kn (b, c) VALUES (%s, %s)",(v1,v2))
print cur.execute("INSERT INTO kn (b, c) VALUES (%s, %s)",(v1,v2))
# Commit your changes in the database
# disconnect from server
conn.close()
a ten execute ma v printe hodnotu none