problem:import csv data

守株待兔 1248283536 at qq.com
Tue Sep 13 13:14:15 CEST 2011


import sqlite3 
con = sqlite3.connect('/home/stock.db')
cur = con.cursor()
cur.execute('''CREATE TABLE quote (ticker TEXT,date TEXT, popen TEXT, high TEXT, low TEXT,vol TEXT,adjclose TEXT);''')
i=/tmp/data.csv
cur.execute('.separator "," ')
cur.execute('.import  %s  quote'  %  i)
con.commit()
cur.close()
con.close()

the output is :
    cur.execute('.separator"," ')
sqlite3.OperationalError: near ".": syntax error

how to fix it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110913/897cbfe9/attachment.html>


More information about the Python-list mailing list